* [ 64/64] rt2x00: rt2x00pci_regbusy_read() - only print register access failure once
From: Greg Kroah-Hartman @ 2013-04-10 22:47 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable, Tim Gardner, Ivo van Doorn,
Gertjan van Wingerde, Helmut Schaa, John W. Linville,
linux-wireless, users, netdev
In-Reply-To: <20130410224333.114387235@linuxfoundation.org>
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Gardner <tim.gardner@canonical.com>
commit 83589b30f1e1dc9898986293c9336b8ce1705dec upstream.
BugLink: http://bugs.launchpad.net/bugs/1128840
It appears that when this register read fails it never recovers, so
I think there is no need to repeat the same error message ad infinitum.
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Cc: Ivo van Doorn <IvDoorn@gmail.com>
Cc: Gertjan van Wingerde <gwingerde@gmail.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: users@rt2x00.serialmonkey.com
Cc: netdev@vger.kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/wireless/rt2x00/rt2x00pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -52,8 +52,8 @@ int rt2x00pci_regbusy_read(struct rt2x00
udelay(REGISTER_BUSY_DELAY);
}
- ERROR(rt2x00dev, "Indirect register access failed: "
- "offset=0x%.08x, value=0x%.08x\n", offset, *reg);
+ printk_once(KERN_ERR "%s() Indirect register access failed: "
+ "offset=0x%.08x, value=0x%.08x\n", __func__, offset, *reg);
*reg = ~0;
return 0;
^ permalink raw reply
* Re: [PATCH net-next] bnx2: make cnic_probe static
From: Michael Chan @ 2013-04-10 22:27 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20130410135340.06f88645@nehalam.linuxnetplumber.net>
On Wed, 2013-04-10 at 13:53 -0700, Stephen Hemminger wrote:
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Michael Chan <mchan@broadcom.com>
>
> --- a/drivers/net/ethernet/broadcom/bnx2.c 2013-04-10 09:10:46.167617920 -0700
> +++ b/drivers/net/ethernet/broadcom/bnx2.c 2013-04-10 13:18:43.946608448 -0700
> @@ -416,7 +416,7 @@ static int bnx2_unregister_cnic(struct n
> return 0;
> }
>
> -struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev)
> +static struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev)
> {
> struct bnx2 *bp = netdev_priv(dev);
> struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
>
^ permalink raw reply
* Re: [PATCH 1/2 v5] usbnet: allow status interrupt URB to always be active
From: Oliver Neukum @ 2013-04-10 21:35 UTC (permalink / raw)
To: Dan Williams
Cc: Ming Lei, Elina Pasheva, Network Development, linux-usb,
Rory Filer, Phil Sutter
In-Reply-To: <1365625850.22411.1.camel@dcbw.foobar.com>
On Wednesday 10 April 2013 15:30:50 Dan Williams wrote:
> Some drivers (sierra_net) need the status interrupt URB
> active even when the device is closed, because they receive
> custom indications from firmware. Add functions to refcount
> the status interrupt URB submit/kill operation so that
> sub-drivers and the generic driver don't fight over whether
> the status interrupt URB is active or not.
>
> A sub-driver can call usbnet_status_start() at any time, but
> the URB is only submitted the first time the function is
> called. Likewise, when the sub-driver is done with the URB,
> it calls usbnet_status_stop() but the URB is only killed when
> all users have stopped it. The URB is still killed and
> re-submitted for suspend/resume, as before, with the same
> refcount it had at suspend.
>
> Signed-off-by: Dan Williams <dcbw@redhat.com>
Acked-by: Oliver Neukum <oliver@neukum.org>
^ permalink raw reply
* [PATCH] net: usb: active URB submitted multiple times
From: Petko Manolov @ 2013-04-10 21:05 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, linux-kernel, Sarah Sharp
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1071 bytes --]
From: Petko Manolov <petkan@nucleusys.com>
Pegasus driver used single callback for sync and async control URBs.
Special flags were employed to distinguish between both, but due to flawed
logic it didn't always work.
Now [get|set]_registers() are much simpler. Async write is also leaner
and does not use single, statically allocated memory for usb_ctrlrequest,
which is another potential race when asynchronously submitting control
URBs.
The socket buffer pool in the receive path is removed. It's existence
didn't make much difference (performance-wise) and the code is better off
without the spinlocks protecting it.
Largely duplicated code in routines reading and writing MII registers is
now packed in __mi_op().
The rest of the patch is pretty much Lindent's fault.
Signed-off-by: Petko Manolov <petkan@nucleusys.com>
---
drivers/net/usb/pegasus.c | 601 +++++++++++++++++++++++++++++++---------------------------------------------------------------------------
drivers/net/usb/pegasus.h | 10 +-
2 files changed, 177 insertions(+), 434 deletions(-)
[-- Attachment #2: Type: TEXT/X-DIFF, Size: 1246 bytes --]
diff --git a/drivers/net/usb/pegasus.h b/drivers/net/usb/pegasus.h
index 65b78b3..809e560 100644
--- a/drivers/net/usb/pegasus.h
+++ b/drivers/net/usb/pegasus.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2003 Petko Manolov - Petkan (petkan@users.sourceforge.net)
+ * Copyright (c) 1999-2013 Petko Manolov - Petkan (petkan@nucleusys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
@@ -34,8 +34,6 @@
#define CTRL_URB_SLEEP 0x00000020
#define PEGASUS_UNPLUG 0x00000040
#define PEGASUS_RX_URB_FAIL 0x00000080
-#define ETH_REGS_CHANGE 0x40000000
-#define ETH_REGS_CHANGED 0x80000000
#define RX_MULTICAST 2
#define RX_PROMISCUOUS 4
@@ -96,12 +94,8 @@ typedef struct pegasus {
int intr_interval;
struct tasklet_struct rx_tl;
struct delayed_work carrier_check;
- struct urb *ctrl_urb, *rx_urb, *tx_urb, *intr_urb;
- struct sk_buff *rx_pool[RX_SKBS];
+ struct urb *rx_urb, *tx_urb, *intr_urb;
struct sk_buff *rx_skb;
- struct usb_ctrlrequest dr;
- wait_queue_head_t ctrl_wait;
- spinlock_t rx_pool_lock;
int chip;
unsigned char intr_buff[8];
__u8 tx_buff[PEGASUS_MTU];
[-- Attachment #3: Type: TEXT/X-DIFF, Size: 37138 bytes --]
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 73051d1..501db20 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2005 Petko Manolov (petkan@users.sourceforge.net)
+ * Copyright (c) 1999-2013 Petko Manolov (petkan@nucleusys.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -26,6 +26,9 @@
* v0.5.1 ethtool support added
* v0.5.5 rx socket buffers are in a pool and the their allocation
* is out of the interrupt routine.
+ * ...
+ * v0.9.1 simplified [get|set]_register(s), async update registers
+ * logic revisited, receive skb_pool removed.
*/
#include <linux/sched.h>
@@ -45,8 +48,8 @@
/*
* Version Information
*/
-#define DRIVER_VERSION "v0.6.14 (2006/09/27)"
-#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
+#define DRIVER_VERSION "v0.9.3 (2013/04/09)"
+#define DRIVER_AUTHOR "Petko Manolov <petkan@nucleusys.com>"
#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
static const char driver_name[] = "pegasus";
@@ -108,299 +111,154 @@ MODULE_PARM_DESC(msg_level, "Override default message level");
MODULE_DEVICE_TABLE(usb, pegasus_ids);
static const struct net_device_ops pegasus_netdev_ops;
-static int update_eth_regs_async(pegasus_t *);
-/* Aargh!!! I _really_ hate such tweaks */
-static void ctrl_callback(struct urb *urb)
+static void async_ctrl_callback(struct urb *urb)
{
- pegasus_t *pegasus = urb->context;
+ struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
int status = urb->status;
- if (!pegasus)
- return;
-
- switch (status) {
- case 0:
- if (pegasus->flags & ETH_REGS_CHANGE) {
- pegasus->flags &= ~ETH_REGS_CHANGE;
- pegasus->flags |= ETH_REGS_CHANGED;
- update_eth_regs_async(pegasus);
- return;
- }
- break;
- case -EINPROGRESS:
- return;
- case -ENOENT:
- break;
- default:
- if (net_ratelimit())
- netif_dbg(pegasus, drv, pegasus->net,
- "%s, status %d\n", __func__, status);
- break;
- }
- pegasus->flags &= ~ETH_REGS_CHANGED;
- wake_up(&pegasus->ctrl_wait);
+ if (status < 0)
+ dev_dbg(&urb->dev->dev, "%s failed with %d", __func__, status);
+ kfree(req);
+ usb_free_urb(urb);
}
-static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
+static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
void *data)
{
int ret;
- char *buffer;
- DECLARE_WAITQUEUE(wait, current);
-
- buffer = kmalloc(size, GFP_KERNEL);
- if (!buffer)
- return -ENOMEM;
-
- add_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
- while (pegasus->flags & ETH_REGS_CHANGED)
- schedule();
- remove_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_RUNNING);
-
- pegasus->dr.bRequestType = PEGASUS_REQT_READ;
- pegasus->dr.bRequest = PEGASUS_REQ_GET_REGS;
- pegasus->dr.wValue = cpu_to_le16(0);
- pegasus->dr.wIndex = cpu_to_le16(indx);
- pegasus->dr.wLength = cpu_to_le16(size);
- pegasus->ctrl_urb->transfer_buffer_length = size;
-
- usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
- usb_rcvctrlpipe(pegasus->usb, 0),
- (char *) &pegasus->dr,
- buffer, size, ctrl_callback, pegasus);
-
- add_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
-
- /* using ATOMIC, we'd never wake up if we slept */
- if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
- set_current_state(TASK_RUNNING);
- if (ret == -ENODEV)
- netif_device_detach(pegasus->net);
- if (net_ratelimit())
- netif_err(pegasus, drv, pegasus->net,
- "%s, status %d\n", __func__, ret);
- goto out;
- }
-
- schedule();
-out:
- remove_wait_queue(&pegasus->ctrl_wait, &wait);
- memcpy(data, buffer, size);
- kfree(buffer);
+ ret = usb_control_msg(pegasus->usb, usb_rcvctrlpipe(pegasus->usb, 0),
+ PEGASUS_REQ_GET_REGS, PEGASUS_REQT_READ, 0,
+ indx, data, size, 1000);
+ if (ret < 0)
+ netif_dbg(pegasus, drv, pegasus->net,
+ "%s returned %d\n", __func__, ret);
return ret;
}
-static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
+static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
void *data)
{
int ret;
- char *buffer;
- DECLARE_WAITQUEUE(wait, current);
-
- buffer = kmemdup(data, size, GFP_KERNEL);
- if (!buffer) {
- netif_warn(pegasus, drv, pegasus->net,
- "out of memory in %s\n", __func__);
- return -ENOMEM;
- }
-
- add_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
- while (pegasus->flags & ETH_REGS_CHANGED)
- schedule();
- remove_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_RUNNING);
-
- pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
- pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS;
- pegasus->dr.wValue = cpu_to_le16(0);
- pegasus->dr.wIndex = cpu_to_le16(indx);
- pegasus->dr.wLength = cpu_to_le16(size);
- pegasus->ctrl_urb->transfer_buffer_length = size;
-
- usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
- usb_sndctrlpipe(pegasus->usb, 0),
- (char *) &pegasus->dr,
- buffer, size, ctrl_callback, pegasus);
-
- add_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
-
- if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
- if (ret == -ENODEV)
- netif_device_detach(pegasus->net);
- netif_err(pegasus, drv, pegasus->net,
- "%s, status %d\n", __func__, ret);
- goto out;
- }
-
- schedule();
-out:
- remove_wait_queue(&pegasus->ctrl_wait, &wait);
- kfree(buffer);
+ ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
+ PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0,
+ indx, data, size, 100);
+ if (ret < 0)
+ netif_dbg(pegasus, drv, pegasus->net,
+ "%s returned %d\n", __func__, ret);
return ret;
}
-static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
+static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
{
int ret;
- char *tmp;
- DECLARE_WAITQUEUE(wait, current);
-
- tmp = kmemdup(&data, 1, GFP_KERNEL);
- if (!tmp) {
- netif_warn(pegasus, drv, pegasus->net,
- "out of memory in %s\n", __func__);
- return -ENOMEM;
- }
- add_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
- while (pegasus->flags & ETH_REGS_CHANGED)
- schedule();
- remove_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_RUNNING);
-
- pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
- pegasus->dr.bRequest = PEGASUS_REQ_SET_REG;
- pegasus->dr.wValue = cpu_to_le16(data);
- pegasus->dr.wIndex = cpu_to_le16(indx);
- pegasus->dr.wLength = cpu_to_le16(1);
- pegasus->ctrl_urb->transfer_buffer_length = 1;
-
- usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
- usb_sndctrlpipe(pegasus->usb, 0),
- (char *) &pegasus->dr,
- tmp, 1, ctrl_callback, pegasus);
-
- add_wait_queue(&pegasus->ctrl_wait, &wait);
- set_current_state(TASK_UNINTERRUPTIBLE);
-
- if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
- if (ret == -ENODEV)
- netif_device_detach(pegasus->net);
- if (net_ratelimit())
- netif_err(pegasus, drv, pegasus->net,
- "%s, status %d\n", __func__, ret);
- goto out;
- }
-
- schedule();
-out:
- remove_wait_queue(&pegasus->ctrl_wait, &wait);
- kfree(tmp);
+ ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
+ PEGASUS_REQ_SET_REG, PEGASUS_REQT_WRITE, data,
+ indx, &data, 1, 1000);
+ if (ret < 0)
+ netif_dbg(pegasus, drv, pegasus->net,
+ "%s returned %d\n", __func__, ret);
return ret;
}
-static int update_eth_regs_async(pegasus_t *pegasus)
+static int update_eth_regs_async(pegasus_t * pegasus)
{
- int ret;
+ int ret = -ENOMEM;
+ struct urb *async_urb;
+ struct usb_ctrlrequest *req;
- pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
- pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS;
- pegasus->dr.wValue = cpu_to_le16(0);
- pegasus->dr.wIndex = cpu_to_le16(EthCtrl0);
- pegasus->dr.wLength = cpu_to_le16(3);
- pegasus->ctrl_urb->transfer_buffer_length = 3;
+ req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
+ if (req == NULL)
+ return ret;
- usb_fill_control_urb(pegasus->ctrl_urb, pegasus->usb,
- usb_sndctrlpipe(pegasus->usb, 0),
- (char *) &pegasus->dr,
- pegasus->eth_regs, 3, ctrl_callback, pegasus);
+ if ((async_urb = usb_alloc_urb(0, GFP_ATOMIC)) == NULL) {
+ kfree(req);
+ return ret;
+ }
+ req->bRequestType = PEGASUS_REQT_WRITE;
+ req->bRequest = PEGASUS_REQ_SET_REGS;
+ req->wValue = cpu_to_le16(0);
+ req->wIndex = cpu_to_le16(EthCtrl0);
+ req->wLength = cpu_to_le16(3);
+
+ usb_fill_control_urb(async_urb, pegasus->usb,
+ usb_sndctrlpipe(pegasus->usb, 0), (void *)req,
+ pegasus->eth_regs, 3, async_ctrl_callback, req);
- if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
+ if ((ret = usb_submit_urb(async_urb, GFP_ATOMIC))) {
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
netif_err(pegasus, drv, pegasus->net,
- "%s, status %d\n", __func__, ret);
+ "%s returned %d\n", __func__, ret);
}
-
return ret;
}
-/* Returns 0 on success, error on failure */
-static int read_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 *regd)
+static int __mii_op(pegasus_t * p, __u8 phy, __u8 indx, __u16 * regd, __u8 cmd)
{
int i;
__u8 data[4] = { phy, 0, 0, indx };
__le16 regdi;
- int ret;
+ int ret = -ETIMEDOUT;
- set_register(pegasus, PhyCtrl, 0);
- set_registers(pegasus, PhyAddr, sizeof(data), data);
- set_register(pegasus, PhyCtrl, (indx | PHY_READ));
+ if (cmd & PHY_WRITE) {
+ __le16 *t = (__le16 *) & data[1];
+ *t = cpu_to_le16(*regd);
+ }
+ set_register(p, PhyCtrl, 0);
+ set_registers(p, PhyAddr, sizeof(data), data);
+ set_register(p, PhyCtrl, (indx | cmd));
for (i = 0; i < REG_TIMEOUT; i++) {
- ret = get_registers(pegasus, PhyCtrl, 1, data);
- if (ret == -ESHUTDOWN)
+ ret = get_registers(p, PhyCtrl, 1, data);
+ if (ret < 0)
goto fail;
if (data[0] & PHY_DONE)
break;
}
-
if (i >= REG_TIMEOUT)
goto fail;
-
- ret = get_registers(pegasus, PhyData, 2, ®di);
- *regd = le16_to_cpu(regdi);
+ if (cmd & PHY_READ) {
+ ret = get_registers(p, PhyData, 2, ®di);
+ *regd = le16_to_cpu(regdi);
+ return ret;
+ }
+ return 0;
+fail:
+ netif_dbg(p, drv, p->net, "%s failed\n", __func__);
return ret;
+}
-fail:
- netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
+/* Returns non-negative int on success, error on failure */
+static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
+{
+ return __mii_op(pegasus, phy, indx, regd, PHY_READ);
+}
- return ret;
+/* Returns zero on success, error on failure */
+static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
+{
+ return __mii_op(pegasus, phy, indx, regd, PHY_WRITE);
}
static int mdio_read(struct net_device *dev, int phy_id, int loc)
{
pegasus_t *pegasus = netdev_priv(dev);
- u16 res;
+ __u16 res;
read_mii_word(pegasus, phy_id, loc, &res);
return (int)res;
}
-static int write_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 regd)
-{
- int i;
- __u8 data[4] = { phy, 0, 0, indx };
- int ret;
-
- data[1] = (u8) regd;
- data[2] = (u8) (regd >> 8);
- set_register(pegasus, PhyCtrl, 0);
- set_registers(pegasus, PhyAddr, sizeof(data), data);
- set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));
- for (i = 0; i < REG_TIMEOUT; i++) {
- ret = get_registers(pegasus, PhyCtrl, 1, data);
- if (ret == -ESHUTDOWN)
- goto fail;
- if (data[0] & PHY_DONE)
- break;
- }
-
- if (i >= REG_TIMEOUT)
- goto fail;
-
- return ret;
-
-fail:
- netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
- return -ETIMEDOUT;
-}
-
static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
{
pegasus_t *pegasus = netdev_priv(dev);
- write_mii_word(pegasus, phy_id, loc, val);
+ write_mii_word(pegasus, phy_id, loc, (__u16 *) & val);
}
-static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
+static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
{
int i;
__u8 tmp;
@@ -420,18 +278,16 @@ static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
}
if (i >= REG_TIMEOUT)
goto fail;
-
ret = get_registers(pegasus, EpromData, 2, &retdatai);
*retdata = le16_to_cpu(retdatai);
return ret;
-
fail:
netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
return -ETIMEDOUT;
}
#ifdef PEGASUS_WRITE_EEPROM
-static inline void enable_eprom_write(pegasus_t *pegasus)
+static inline void enable_eprom_write(pegasus_t * pegasus)
{
__u8 tmp;
int ret;
@@ -440,7 +296,7 @@ static inline void enable_eprom_write(pegasus_t *pegasus)
set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE);
}
-static inline void disable_eprom_write(pegasus_t *pegasus)
+static inline void disable_eprom_write(pegasus_t * pegasus)
{
__u8 tmp;
int ret;
@@ -450,7 +306,7 @@ static inline void disable_eprom_write(pegasus_t *pegasus)
set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE);
}
-static int write_eprom_word(pegasus_t *pegasus, __u8 index, __u16 data)
+static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
{
int i;
__u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
@@ -473,16 +329,14 @@ static int write_eprom_word(pegasus_t *pegasus, __u8 index, __u16 data)
disable_eprom_write(pegasus);
if (i >= REG_TIMEOUT)
goto fail;
-
return ret;
-
fail:
netif_warn(pegasus, drv, pegasus->net, "%s failed\n", __func__);
return -ETIMEDOUT;
}
-#endif /* PEGASUS_WRITE_EEPROM */
+#endif /* PEGASUS_WRITE_EEPROM */
-static inline void get_node_id(pegasus_t *pegasus, __u8 *id)
+static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
{
int i;
__u16 w16;
@@ -493,7 +347,7 @@ static inline void get_node_id(pegasus_t *pegasus, __u8 *id)
}
}
-static void set_ethernet_addr(pegasus_t *pegasus)
+static void set_ethernet_addr(pegasus_t * pegasus)
{
__u8 node_id[6];
@@ -506,7 +360,7 @@ static void set_ethernet_addr(pegasus_t *pegasus)
memcpy(pegasus->net->dev_addr, node_id, sizeof(node_id));
}
-static inline int reset_mac(pegasus_t *pegasus)
+static inline int reset_mac(pegasus_t * pegasus)
{
__u8 data = 0x8;
int i;
@@ -528,7 +382,6 @@ static inline int reset_mac(pegasus_t *pegasus)
}
if (i == REG_TIMEOUT)
return -ETIMEDOUT;
-
if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
set_register(pegasus, Gpio0, 0x24);
@@ -537,18 +390,17 @@ static inline int reset_mac(pegasus_t *pegasus)
if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_ELCON) {
__u16 auxmode;
read_mii_word(pegasus, 3, 0x1b, &auxmode);
- write_mii_word(pegasus, 3, 0x1b, auxmode | 4);
+ auxmode |= 4;
+ write_mii_word(pegasus, 3, 0x1b, &auxmode);
}
-
return 0;
}
-static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
+static void enable_net_traffic(struct net_device *dev, struct usb_device *usb)
{
__u16 linkpart;
__u8 data[4];
pegasus_t *pegasus = netdev_priv(dev);
- int ret;
read_mii_word(pegasus, pegasus->phy, MII_LPA, &linkpart);
data[0] = 0xc9;
@@ -562,62 +414,16 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
data[2] = loopback ? 0x09 : 0x01;
memcpy(pegasus->eth_regs, data, sizeof(data));
- ret = set_registers(pegasus, EthCtrl0, 3, data);
+ set_registers(pegasus, EthCtrl0, 3, data);
if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 ||
usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
- u16 auxmode;
+ __u16 auxmode;
read_mii_word(pegasus, 0, 0x1b, &auxmode);
- write_mii_word(pegasus, 0, 0x1b, auxmode | 4);
+ auxmode |= 4;
+ write_mii_word(pegasus, 0, 0x1b, &auxmode);
}
-
- return ret;
-}
-
-static void fill_skb_pool(pegasus_t *pegasus)
-{
- int i;
-
- for (i = 0; i < RX_SKBS; i++) {
- if (pegasus->rx_pool[i])
- continue;
- pegasus->rx_pool[i] = dev_alloc_skb(PEGASUS_MTU + 2);
- /*
- ** we give up if the allocation fail. the tasklet will be
- ** rescheduled again anyway...
- */
- if (pegasus->rx_pool[i] == NULL)
- return;
- skb_reserve(pegasus->rx_pool[i], 2);
- }
-}
-
-static void free_skb_pool(pegasus_t *pegasus)
-{
- int i;
-
- for (i = 0; i < RX_SKBS; i++) {
- if (pegasus->rx_pool[i]) {
- dev_kfree_skb(pegasus->rx_pool[i]);
- pegasus->rx_pool[i] = NULL;
- }
- }
-}
-
-static inline struct sk_buff *pull_skb(pegasus_t * pegasus)
-{
- int i;
- struct sk_buff *skb;
-
- for (i = 0; i < RX_SKBS; i++) {
- if (likely(pegasus->rx_pool[i] != NULL)) {
- skb = pegasus->rx_pool[i];
- pegasus->rx_pool[i] = NULL;
- return skb;
- }
- }
- return NULL;
}
static void read_bulk_callback(struct urb *urb)
@@ -643,7 +449,7 @@ static void read_bulk_callback(struct urb *urb)
netif_dbg(pegasus, rx_err, net, "reset MAC\n");
pegasus->flags &= ~PEGASUS_RX_BUSY;
break;
- case -EPIPE: /* stall, or disconnect from TT */
+ case -EPIPE: /* stall, or disconnect from TT */
/* FIXME schedule work to clear the halt */
netif_warn(pegasus, rx_err, net, "no rx stall recovery\n");
return;
@@ -665,16 +471,16 @@ static void read_bulk_callback(struct urb *urb)
netif_dbg(pegasus, rx_err, net,
"RX packet error %x\n", rx_status);
pegasus->stats.rx_errors++;
- if (rx_status & 0x06) /* long or runt */
+ if (rx_status & 0x06) /* long or runt */
pegasus->stats.rx_length_errors++;
if (rx_status & 0x08)
pegasus->stats.rx_crc_errors++;
- if (rx_status & 0x10) /* extra bits */
+ if (rx_status & 0x10) /* extra bits */
pegasus->stats.rx_frame_errors++;
goto goon;
}
if (pegasus->chip == 0x8513) {
- pkt_len = le32_to_cpu(*(__le32 *)urb->transfer_buffer);
+ pkt_len = le32_to_cpu(*(__le32 *) urb->transfer_buffer);
pkt_len &= 0x0fff;
pegasus->rx_skb->data += 2;
} else {
@@ -683,14 +489,12 @@ static void read_bulk_callback(struct urb *urb)
pkt_len &= 0xfff;
pkt_len -= 8;
}
-
/*
* If the packet is unreasonably long, quietly drop it rather than
* kernel panicing by calling skb_put.
*/
if (pkt_len > PEGASUS_MTU)
goto goon;
-
/*
* at this point we are sure pegasus->rx_skb != NULL
* so we go ahead and pass up the packet.
@@ -704,10 +508,8 @@ static void read_bulk_callback(struct urb *urb)
if (pegasus->flags & PEGASUS_UNPLUG)
return;
- spin_lock(&pegasus->rx_pool_lock);
- pegasus->rx_skb = pull_skb(pegasus);
- spin_unlock(&pegasus->rx_pool_lock);
-
+ pegasus->rx_skb = __netdev_alloc_skb_ip_align(pegasus->net,
+ PEGASUS_MTU, GFP_ATOMIC);
if (pegasus->rx_skb == NULL)
goto tl_sched;
goon:
@@ -724,9 +526,7 @@ goon:
} else {
pegasus->flags &= ~PEGASUS_RX_URB_FAIL;
}
-
return;
-
tl_sched:
tasklet_schedule(&pegasus->rx_tl);
}
@@ -734,24 +534,22 @@ tl_sched:
static void rx_fixup(unsigned long data)
{
pegasus_t *pegasus;
- unsigned long flags;
int status;
pegasus = (pegasus_t *) data;
if (pegasus->flags & PEGASUS_UNPLUG)
return;
-
- spin_lock_irqsave(&pegasus->rx_pool_lock, flags);
- fill_skb_pool(pegasus);
if (pegasus->flags & PEGASUS_RX_URB_FAIL)
if (pegasus->rx_skb)
goto try_again;
if (pegasus->rx_skb == NULL)
- pegasus->rx_skb = pull_skb(pegasus);
+ pegasus->rx_skb = __netdev_alloc_skb_ip_align(pegasus->net,
+ PEGASUS_MTU,
+ GFP_ATOMIC);
if (pegasus->rx_skb == NULL) {
netif_warn(pegasus, rx_err, pegasus->net, "low on memory\n");
tasklet_schedule(&pegasus->rx_tl);
- goto done;
+ return;
}
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
@@ -767,8 +565,6 @@ try_again:
} else {
pegasus->flags &= ~PEGASUS_RX_URB_FAIL;
}
-done:
- spin_unlock_irqrestore(&pegasus->rx_pool_lock, flags);
}
static void write_bulk_callback(struct urb *urb)
@@ -779,12 +575,9 @@ static void write_bulk_callback(struct urb *urb)
if (!pegasus)
return;
-
net = pegasus->net;
-
if (!netif_device_present(net) || !netif_running(net))
return;
-
switch (status) {
case -EPIPE:
/* FIXME schedule_work() to clear the tx halt */
@@ -802,8 +595,7 @@ static void write_bulk_callback(struct urb *urb)
case 0:
break;
}
-
- net->trans_start = jiffies; /* prevent tx timeout */
+ net->trans_start = jiffies; /* prevent tx timeout */
netif_wake_queue(net);
}
@@ -816,7 +608,6 @@ static void intr_callback(struct urb *urb)
if (!pegasus)
return;
net = pegasus->net;
-
switch (status) {
case 0:
break;
@@ -830,13 +621,12 @@ static void intr_callback(struct urb *urb)
*/
netif_dbg(pegasus, timer, net, "intr status %d\n", status);
}
-
if (urb->actual_length >= 6) {
u8 *d = urb->transfer_buffer;
/* byte 0 == tx_status1, reg 2B */
- if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL
- |LATE_COL|JABBER_TIMEOUT)) {
+ if (d[0] & (TX_UNDERRUN | EXCESSIVE_COL
+ | LATE_COL | JABBER_TIMEOUT)) {
pegasus->stats.tx_errors++;
if (d[0] & TX_UNDERRUN)
pegasus->stats.tx_fifo_errors++;
@@ -854,7 +644,6 @@ static void intr_callback(struct urb *urb)
/* bytes 3-4 == rx_lostpkt, reg 2E/2F */
pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
}
-
res = usb_submit_urb(urb, GFP_ATOMIC);
if (res == -ENODEV)
netif_device_detach(pegasus->net);
@@ -872,7 +661,7 @@ static void pegasus_tx_timeout(struct net_device *net)
}
static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
- struct net_device *net)
+ struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
int count = ((skb->len + 2) & 0x3f) ? skb->len + 2 : skb->len + 3;
@@ -890,10 +679,10 @@ static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
if ((res = usb_submit_urb(pegasus->tx_urb, GFP_ATOMIC))) {
netif_warn(pegasus, tx_err, net, "fail tx, %d\n", res);
switch (res) {
- case -EPIPE: /* stall, or disconnect from TT */
+ case -EPIPE: /* stall, or disconnect from TT */
/* cleanup should already have been scheduled */
break;
- case -ENODEV: /* disconnect() upcoming */
+ case -ENODEV: /* disconnect() upcoming */
case -EPERM:
netif_device_detach(pegasus->net);
break;
@@ -915,14 +704,14 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
return &((pegasus_t *) netdev_priv(dev))->stats;
}
-static inline void disable_net_traffic(pegasus_t *pegasus)
+static inline void disable_net_traffic(pegasus_t * pegasus)
{
__le16 tmp = cpu_to_le16(0);
set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp);
}
-static inline void get_interrupt_interval(pegasus_t *pegasus)
+static inline void get_interrupt_interval(pegasus_t * pegasus)
{
u16 data;
u8 interval;
@@ -935,7 +724,7 @@ static inline void get_interrupt_interval(pegasus_t *pegasus)
"intr interval changed from %ums to %ums\n",
interval, 0x80);
interval = 0x80;
- data = (data & 0x00FF) | ((u16)interval << 8);
+ data = (data & 0x00FF) | ((u16) interval << 8);
#ifdef PEGASUS_WRITE_EEPROM
write_eprom_word(pegasus, 4, data);
#endif
@@ -951,71 +740,58 @@ static void set_carrier(struct net_device *net)
if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
return;
-
if (tmp & BMSR_LSTATUS)
netif_carrier_on(net);
else
netif_carrier_off(net);
}
-static void free_all_urbs(pegasus_t *pegasus)
+static void free_all_urbs(pegasus_t * pegasus)
{
usb_free_urb(pegasus->intr_urb);
usb_free_urb(pegasus->tx_urb);
usb_free_urb(pegasus->rx_urb);
- usb_free_urb(pegasus->ctrl_urb);
}
-static void unlink_all_urbs(pegasus_t *pegasus)
+static void unlink_all_urbs(pegasus_t * pegasus)
{
usb_kill_urb(pegasus->intr_urb);
usb_kill_urb(pegasus->tx_urb);
usb_kill_urb(pegasus->rx_urb);
- usb_kill_urb(pegasus->ctrl_urb);
}
-static int alloc_urbs(pegasus_t *pegasus)
+static int alloc_urbs(pegasus_t * pegasus)
{
- pegasus->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
- if (!pegasus->ctrl_urb)
- return 0;
pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->rx_urb) {
- usb_free_urb(pegasus->ctrl_urb);
return 0;
}
pegasus->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->tx_urb) {
usb_free_urb(pegasus->rx_urb);
- usb_free_urb(pegasus->ctrl_urb);
return 0;
}
pegasus->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->intr_urb) {
usb_free_urb(pegasus->tx_urb);
usb_free_urb(pegasus->rx_urb);
- usb_free_urb(pegasus->ctrl_urb);
return 0;
}
-
return 1;
}
static int pegasus_open(struct net_device *net)
{
pegasus_t *pegasus = netdev_priv(net);
- int res;
+ int res = -ENOMEM;
if (pegasus->rx_skb == NULL)
- pegasus->rx_skb = pull_skb(pegasus);
- /*
- ** Note: no point to free the pool. it is empty :-)
- */
+ pegasus->rx_skb = __netdev_alloc_skb_ip_align(pegasus->net,
+ PEGASUS_MTU,
+ GFP_KERNEL);
if (!pegasus->rx_skb)
- return -ENOMEM;
-
+ goto exit;
res = set_registers(pegasus, EthID, 6, net->dev_addr);
-
usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU + 8,
@@ -1026,7 +802,6 @@ static int pegasus_open(struct net_device *net)
netif_dbg(pegasus, ifup, net, "failed rx_urb, %d\n", res);
goto exit;
}
-
usb_fill_int_urb(pegasus->intr_urb, pegasus->usb,
usb_rcvintpipe(pegasus->usb, 3),
pegasus->intr_buff, sizeof(pegasus->intr_buff),
@@ -1038,18 +813,9 @@ static int pegasus_open(struct net_device *net)
usb_kill_urb(pegasus->rx_urb);
goto exit;
}
- if ((res = enable_net_traffic(net, pegasus->usb))) {
- netif_dbg(pegasus, ifup, net,
- "can't enable_net_traffic() - %d\n", res);
- res = -EIO;
- usb_kill_urb(pegasus->rx_urb);
- usb_kill_urb(pegasus->intr_urb);
- free_skb_pool(pegasus);
- goto exit;
- }
+ enable_net_traffic(net, pegasus->usb);
set_carrier(net);
netif_start_queue(net);
- netif_dbg(pegasus, ifup, net, "open\n");
res = 0;
exit:
return res;
@@ -1081,25 +847,22 @@ static void pegasus_get_drvinfo(struct net_device *dev,
/* also handles three patterns of some kind in hardware */
#define WOL_SUPPORTED (WAKE_MAGIC|WAKE_PHY)
-static void
-pegasus_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+static void pegasus_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
- pegasus_t *pegasus = netdev_priv(dev);
+ pegasus_t *pegasus = netdev_priv(dev);
wol->supported = WAKE_MAGIC | WAKE_PHY;
wol->wolopts = pegasus->wolopts;
}
-static int
-pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+static int pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
{
- pegasus_t *pegasus = netdev_priv(dev);
- u8 reg78 = 0x04;
- int ret;
+ pegasus_t *pegasus = netdev_priv(dev);
+ u8 reg78 = 0x04;
+ int r;
if (wol->wolopts & ~WOL_SUPPORTED)
return -EINVAL;
-
if (wol->wolopts & WAKE_MAGIC)
reg78 |= 0x80;
if (wol->wolopts & WAKE_PHY)
@@ -1111,11 +874,10 @@ pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
pegasus->eth_regs[0] &= ~0x10;
pegasus->wolopts = wol->wolopts;
- ret = set_register(pegasus, WakeupControl, reg78);
- if (!ret)
- ret = device_set_wakeup_enable(&pegasus->usb->dev,
- wol->wolopts);
- return ret;
+ r = set_register(pegasus, WakeupControl, reg78);
+ if (!r)
+ r = device_set_wakeup_enable(&pegasus->usb->dev, wol->wolopts);
+ return r;
}
static inline void pegasus_reset_wol(struct net_device *dev)
@@ -1123,7 +885,7 @@ static inline void pegasus_reset_wol(struct net_device *dev)
struct ethtool_wolinfo wol;
memset(&wol, 0, sizeof wol);
- (void) pegasus_set_wol(dev, &wol);
+ (void)pegasus_set_wol(dev, &wol);
}
static int
@@ -1133,6 +895,7 @@ pegasus_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
pegasus = netdev_priv(dev);
mii_ethtool_gset(&pegasus->mii, ecmd);
+
return 0;
}
@@ -1140,30 +903,35 @@ static int
pegasus_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
{
pegasus_t *pegasus = netdev_priv(dev);
+
return mii_ethtool_sset(&pegasus->mii, ecmd);
}
static int pegasus_nway_reset(struct net_device *dev)
{
pegasus_t *pegasus = netdev_priv(dev);
+
return mii_nway_restart(&pegasus->mii);
}
static u32 pegasus_get_link(struct net_device *dev)
{
pegasus_t *pegasus = netdev_priv(dev);
+
return mii_link_ok(&pegasus->mii);
}
static u32 pegasus_get_msglevel(struct net_device *dev)
{
pegasus_t *pegasus = netdev_priv(dev);
+
return pegasus->msg_enable;
}
static void pegasus_set_msglevel(struct net_device *dev, u32 v)
{
pegasus_t *pegasus = netdev_priv(dev);
+
pegasus->msg_enable = v;
}
@@ -1181,7 +949,7 @@ static const struct ethtool_ops ops = {
static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
{
- __u16 *data = (__u16 *) &rq->ifr_ifru;
+ __u16 *data = (__u16 *) & rq->ifr_ifru;
pegasus_t *pegasus = netdev_priv(net);
int res;
@@ -1195,7 +963,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
case SIOCDEVPRIVATE + 2:
if (!capable(CAP_NET_ADMIN))
return -EPERM;
- write_mii_word(pegasus, pegasus->phy, data[1] & 0x1f, data[2]);
+ write_mii_word(pegasus, pegasus->phy, data[1] & 0x1f, &data[2]);
res = 0;
break;
default:
@@ -1218,15 +986,12 @@ static void pegasus_set_multicast(struct net_device *net)
} else {
pegasus->eth_regs[EthCtrl0] &= ~RX_MULTICAST;
pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
+ netif_dbg(pegasus, link, net, "general mode\n");
}
-
- pegasus->ctrl_urb->status = 0;
-
- pegasus->flags |= ETH_REGS_CHANGE;
- ctrl_callback(pegasus->ctrl_urb);
+ update_eth_regs_async(pegasus);
}
-static __u8 mii_phy_probe(pegasus_t *pegasus)
+static __u8 mii_phy_probe(pegasus_t * pegasus)
{
int i;
__u16 tmp;
@@ -1238,11 +1003,10 @@ static __u8 mii_phy_probe(pegasus_t *pegasus)
else
return i;
}
-
return 0xff;
}
-static inline void setup_pegasus_II(pegasus_t *pegasus)
+static inline void setup_pegasus_II(pegasus_t * pegasus)
{
__u8 data = 0xa5;
@@ -1253,26 +1017,21 @@ static inline void setup_pegasus_II(pegasus_t *pegasus)
set_register(pegasus, Reg7b, 0);
else
set_register(pegasus, Reg7b, 2);
-
set_register(pegasus, 0x83, data);
get_registers(pegasus, 0x83, 1, &data);
-
if (data == 0xa5)
pegasus->chip = 0x8513;
else
pegasus->chip = 0;
-
set_register(pegasus, 0x80, 0xc0);
set_register(pegasus, 0x83, 0xff);
set_register(pegasus, 0x84, 0x01);
-
if (pegasus->features & HAS_HOME_PNA && mii_mode)
set_register(pegasus, Reg81, 6);
else
set_register(pegasus, Reg81, 2);
}
-
static int pegasus_count;
static struct workqueue_struct *pegasus_workqueue;
#define CARRIER_CHECK_DELAY (2 * HZ)
@@ -1281,10 +1040,9 @@ static void check_carrier(struct work_struct *work)
{
pegasus_t *pegasus = container_of(work, pegasus_t, carrier_check.work);
set_carrier(pegasus->net);
- if (!(pegasus->flags & PEGASUS_UNPLUG)) {
+ if (!(pegasus->flags & PEGASUS_UNPLUG))
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
- CARRIER_CHECK_DELAY);
- }
+ CARRIER_CHECK_DELAY);
}
static int pegasus_blacklisted(struct usb_device *udev)
@@ -1299,11 +1057,11 @@ static int pegasus_blacklisted(struct usb_device *udev)
(udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) &&
(udd->bDeviceProtocol == 1))
return 1;
-
return 0;
}
-/* we rely on probe() and remove() being serialized so we
+/*
+ * we rely on probe() and remove() being serialized so we
* don't need extra locking on pegasus_count.
*/
static void pegasus_dec_workqueue(void)
@@ -1340,14 +1098,13 @@ static int pegasus_probe(struct usb_interface *intf,
pegasus = netdev_priv(net);
pegasus->dev_index = dev_index;
- init_waitqueue_head(&pegasus->ctrl_wait);
if (!alloc_urbs(pegasus)) {
dev_err(&intf->dev, "can't allocate %s\n", "urbs");
goto out1;
}
- tasklet_init(&pegasus->rx_tl, rx_fixup, (unsigned long) pegasus);
+ tasklet_init(&pegasus->rx_tl, rx_fixup, (unsigned long)pegasus);
INIT_DELAYED_WORK(&pegasus->carrier_check, check_carrier);
@@ -1355,7 +1112,6 @@ static int pegasus_probe(struct usb_interface *intf,
pegasus->usb = dev;
pegasus->net = net;
-
net->watchdog_timeo = PEGASUS_TX_TIMEOUT;
net->netdev_ops = &pegasus_netdev_ops;
SET_ETHTOOL_OPS(net, &ops);
@@ -1364,9 +1120,9 @@ static int pegasus_probe(struct usb_interface *intf,
pegasus->mii.mdio_write = mdio_write;
pegasus->mii.phy_id_mask = 0x1f;
pegasus->mii.reg_num_mask = 0x1f;
- spin_lock_init(&pegasus->rx_pool_lock);
pegasus->msg_enable = netif_msg_init(msg_level, NETIF_MSG_DRV
- | NETIF_MSG_PROBE | NETIF_MSG_LINK);
+ | NETIF_MSG_PROBE
+ | NETIF_MSG_LINK);
pegasus->features = usb_dev_id[dev_index].private;
get_interrupt_interval(pegasus);
@@ -1376,7 +1132,6 @@ static int pegasus_probe(struct usb_interface *intf,
goto out2;
}
set_ethernet_addr(pegasus);
- fill_skb_pool(pegasus);
if (pegasus->features & PEGASUS_II) {
dev_info(&intf->dev, "setup Pegasus II specific registers\n");
setup_pegasus_II(pegasus);
@@ -1394,17 +1149,12 @@ static int pegasus_probe(struct usb_interface *intf,
if (res)
goto out3;
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
- CARRIER_CHECK_DELAY);
-
- dev_info(&intf->dev, "%s, %s, %pM\n",
- net->name,
- usb_dev_id[dev_index].name,
- net->dev_addr);
+ CARRIER_CHECK_DELAY);
+ dev_info(&intf->dev, "%s, %s: %pM\n", net->name,
+ usb_dev_id[dev_index].name, net->dev_addr);
return 0;
-
out3:
usb_set_intfdata(intf, NULL);
- free_skb_pool(pegasus);
out2:
free_all_urbs(pegasus);
out1:
@@ -1429,7 +1179,6 @@ static void pegasus_disconnect(struct usb_interface *intf)
unregister_netdev(pegasus->net);
unlink_all_urbs(pegasus);
free_all_urbs(pegasus);
- free_skb_pool(pegasus);
if (pegasus->rx_skb != NULL) {
dev_kfree_skb(pegasus->rx_skb);
pegasus->rx_skb = NULL;
@@ -1466,21 +1215,21 @@ static int pegasus_resume(struct usb_interface *intf)
intr_callback(pegasus->intr_urb);
}
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
- CARRIER_CHECK_DELAY);
+ CARRIER_CHECK_DELAY);
return 0;
}
static const struct net_device_ops pegasus_netdev_ops = {
- .ndo_open = pegasus_open,
- .ndo_stop = pegasus_close,
- .ndo_do_ioctl = pegasus_ioctl,
- .ndo_start_xmit = pegasus_start_xmit,
- .ndo_set_rx_mode = pegasus_set_multicast,
- .ndo_get_stats = pegasus_netdev_stats,
- .ndo_tx_timeout = pegasus_tx_timeout,
- .ndo_change_mtu = eth_change_mtu,
- .ndo_set_mac_address = eth_mac_addr,
- .ndo_validate_addr = eth_validate_addr,
+ .ndo_open = pegasus_open,
+ .ndo_stop = pegasus_close,
+ .ndo_do_ioctl = pegasus_ioctl,
+ .ndo_start_xmit = pegasus_start_xmit,
+ .ndo_set_rx_mode = pegasus_set_multicast,
+ .ndo_get_stats = pegasus_netdev_stats,
+ .ndo_tx_timeout = pegasus_tx_timeout,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_set_mac_address = eth_mac_addr,
+ .ndo_validate_addr = eth_validate_addr,
};
static struct usb_driver pegasus_driver = {
@@ -1500,7 +1249,7 @@ static void __init parse_id(char *id)
if ((token = strsep(&id, ":")) != NULL)
name = token;
- /* name now points to a null terminated string*/
+ /* name now points to a null terminated string */
if ((token = strsep(&id, ":")) != NULL)
vendor_id = simple_strtoul(token, NULL, 16);
if ((token = strsep(&id, ":")) != NULL)
@@ -1514,7 +1263,7 @@ static void __init parse_id(char *id)
if (device_id > 0x10000 || device_id == 0)
return;
- for (i = 0; usb_dev_id[i].name; i++);
+ for (i = 0; usb_dev_id[i].name; i++) ;
usb_dev_id[i].name = name;
usb_dev_id[i].vendor = vendor_id;
usb_dev_id[i].device = device_id;
^ permalink raw reply related
* [PATCH net-next] netprio_cgroup: make local table static
From: Stephen Hemminger @ 2013-04-10 20:56 UTC (permalink / raw)
To: Neil Horman, David S. Miller; +Cc: netdev
Minor sparse warning
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/net/core/netprio_cgroup.c 2013-04-10 13:36:56.928429191 -0700
+++ b/net/core/netprio_cgroup.c 2013-04-10 13:37:04.516330753 -0700
@@ -247,7 +247,7 @@ static struct cftype ss_files[] = {
{ } /* terminate */
};
-struct cgroup_subsys net_prio_subsys = {
+static struct cgroup_subsys net_prio_subsys = {
.name = "net_prio",
.css_alloc = cgrp_css_alloc,
.css_online = cgrp_css_online,
^ permalink raw reply
* [PATCH net-next] xen-netback: fix sparse warning
From: Stephen Hemminger @ 2013-04-10 20:54 UTC (permalink / raw)
To: Ian Campbell, David Miller; +Cc: netdev
Fix warning about 0 used as NULL.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/drivers/net/xen-netback/netback.c 2013-04-10 09:10:46.559612835 -0700
+++ b/drivers/net/xen-netback/netback.c 2013-04-10 13:21:51.408176509 -0700
@@ -1551,7 +1551,7 @@ static void xen_netbk_idx_release(struct
xenvif_put(vif);
- netbk->mmap_pages[pending_idx]->mapping = 0;
+ netbk->mmap_pages[pending_idx]->mapping = NULL;
put_page(netbk->mmap_pages[pending_idx]);
netbk->mmap_pages[pending_idx] = NULL;
}
^ permalink raw reply
* [PATCH net-next] bnx2: make cnic_probe static
From: Stephen Hemminger @ 2013-04-10 20:53 UTC (permalink / raw)
To: Michael Chan, David Miller; +Cc: netdev
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/drivers/net/ethernet/broadcom/bnx2.c 2013-04-10 09:10:46.167617920 -0700
+++ b/drivers/net/ethernet/broadcom/bnx2.c 2013-04-10 13:18:43.946608448 -0700
@@ -416,7 +416,7 @@ static int bnx2_unregister_cnic(struct n
return 0;
}
-struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev)
+static struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev)
{
struct bnx2 *bp = netdev_priv(dev);
struct cnic_eth_dev *cp = &bp->cnic_eth_dev;
^ permalink raw reply
* Re: [PATCH 1/3] if.h: add IFF_BRIDGE_RESTRICTED flag
From: Stephen Hemminger @ 2013-04-10 20:46 UTC (permalink / raw)
To: Antonio Quartulli
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
Jamal Hadi Salim, David S. Miller
In-Reply-To: <20130410165434.GB5177@open-mesh.com>
[-- Attachment #1: Type: text/plain, Size: 787 bytes --]
On Wed, 10 Apr 2013 18:54:34 +0200
Antonio Quartulli <antonio@open-mesh.com> wrote:
> Hi Jamal, all,
>
> On Tue, Apr 09, 2013 at 08:49:17 -0700, Jamal Hadi Salim wrote:
> > On 13-04-09 09:51 AM, Antonio Quartulli wrote:
> >
> > >
> > > Does this work at the bridge level? A packet entering a port and going out from
> > > another one can be affected by tc/mark?
> >
> > Yes of course. And on any construct that looks like a netdev (tunnels etc).
> >
>
> Thanks for your hints. After having struggled a bit I found out how to do it
> using ebtables and the mark target :)
>
> Thanks a Lot!
>
> These patches seem to be useless now
>
> Cheers,
>
Come back again, though. The ebtables method offers more flexibility which can
be a good or bad thing...
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] net: add checks if dev->netdev_ops is NULL in register_netdevice()
From: Stephen Hemminger @ 2013-04-10 20:45 UTC (permalink / raw)
To: dingtianhong
Cc: David S. Miller, Eric Dumazet, Alexander Duyck, Netdev, Li Zefan,
Xinwei Hu
In-Reply-To: <51629159.9040000@huawei.com>
On Mon, 8 Apr 2013 17:43:53 +0800
dingtianhong <dingtianhong@huawei.com> wrote:
> In some cases netdev->netdev_ops could be NULL in the register_netdevice(),
> thus a NULL point deference happens and lead to oops:
>
> [ 8260.836400] BUG: unable to handle kernel NULL pointer dereference at (null)
> [ 8260.955306] IP: [<ffffffff81388333>] register_netdevice+0x73/0x2d0
> [ 8261.054888] PGD 2f4dcd067 PUD 2f4de0067 PMD 0
> [ 8261.134244] Oops: 0000 [#1] SMP
> [ 8261.198938] CPU 0
> [ 8262.605182] RIP: 0010:[<ffffffff81388333>] [<ffffffff81388333>] register_netdevice+0x73/0x2d0
> [ 8262.741859] RSP: 0018:ffff8802f489f9f8 EFLAGS: 00010246
> [ 8262.839463] RAX: 0000000000000000 RBX: ffff8802f4e73000 RCX: ffff8802f4e73006
> [ 8262.959484] RDX: 0000000000000000 RSI: 00000000daa92527 RDI: ffff8802f4e73006
> [ 8263.079352] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff880327d898c0
> [ 8263.198987] R10: 00000000000000c1 R11: 0000000000000000 R12: ffffffff81fed080
> [ 8263.318401] R13: ffffffff81fed080 R14: ffff8802f4e73000 R15: 0000000000000000
> [ 8263.438014] FS: 00007f01dfa81700(0000) GS:ffff88033f200000(0000) knlGS:0000000000000000
> [ 8263.569778] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 8263.673859] CR2: 0000000000000000 CR3: 000000032893f000 CR4: 00000000000006f0
> [ 8263.794922] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [ 8263.915734] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> [ 8264.036251] Process rmcli (pid: 14089, threadinfo ffff8802f489e000, task ffff880324708080)
> [ 8264.170961] Stack:
> [ 8264.231328] ffff88032a3c0000 0000000000000003 0000000000000003 ffff88032a3c0000
> [ 8264.356967] 0000000000000003 ffffffffa039dbcb 000000003ec216c0 0000000000000246
> [ 8264.483081] 382e30363238205b 00205d3900000006 ff00305f63696e76 0000000000000003
>
> We should check the point to avoid the oops.
>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
I notice you truncated the back trace. You should include the whole thing
so the buggy driver can be found and shot. If it is your own code fix it.
Adding a BUG_ON() is a waste, the NULL trap is the same effect.
^ permalink raw reply
* [PATCH v2] net: mv643xx_eth: use managed devm_kzalloc
From: Sebastian Hesselbarth @ 2013-04-10 20:42 UTC (permalink / raw)
To: Sebastian Hesselbarth
Cc: Lennert Buytenhek, Andrew Lunn, Jason Cooper, Florian Fainelli,
Sergei Shtylyov, netdev, linux-kernel
In-Reply-To: <1365615483-26318-1-git-send-email-sebastian.hesselbarth@gmail.com>
This patch moves shared private data kzalloc to managed devm_kzalloc and
cleans now unneccessary kfree and error handling.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Changes from v1:
- replaced EADDRNOTAVAIL with ENOMEM on failing ioremap (Reported by
Sergei Shtylyov)
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/marvell/mv643xx_eth.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index bbe6104..305038f 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2547,25 +2547,22 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
struct mv643xx_eth_shared_private *msp;
const struct mbus_dram_target_info *dram;
struct resource *res;
- int ret;
if (!mv643xx_eth_version_printed++)
pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
mv643xx_eth_driver_version);
- ret = -EINVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL)
- goto out;
+ return -EINVAL;
- ret = -ENOMEM;
- msp = kzalloc(sizeof(*msp), GFP_KERNEL);
+ msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
if (msp == NULL)
- goto out;
+ return -ENOMEM;
msp->base = ioremap(res->start, resource_size(res));
if (msp->base == NULL)
- goto out_free;
+ return -ENOMEM;
msp->clk = devm_clk_get(&pdev->dev, NULL);
if (!IS_ERR(msp->clk))
@@ -2585,11 +2582,6 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, msp);
return 0;
-
-out_free:
- kfree(msp);
-out:
- return ret;
}
static int mv643xx_eth_shared_remove(struct platform_device *pdev)
@@ -2599,7 +2591,6 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev)
iounmap(msp->base);
if (!IS_ERR(msp->clk))
clk_disable_unprepare(msp->clk);
- kfree(msp);
return 0;
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/2 v5] sierra_net: keep status interrupt URB active
From: Dan Williams @ 2013-04-10 20:33 UTC (permalink / raw)
To: Oliver Neukum
Cc: Ming Lei, Elina Pasheva, Network Development, linux-usb,
Rory Filer, Phil Sutter
In-Reply-To: <1365625850.22411.1.camel-wKZy7rqYPVb5EHUCmHmTqw@public.gmane.org>
The driver and firmware sync up through SYNC messages, and the
firmware's affirmative reply to these SYNC messages appears to be the
"Reset" indication received via the status interrupt endpoint. Thus the
driver needs the status interrupt endpoint always active so that the
Reset indication can be received even if the netdev is closed, which is
the case right after device insertion.
Signed-off-by: Dan Williams <dcbw-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
drivers/net/usb/sierra_net.c | 40 ++++++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c
index 79ab243..d0fa5c18 100644
--- a/drivers/net/usb/sierra_net.c
+++ b/drivers/net/usb/sierra_net.c
@@ -427,6 +427,13 @@ static void sierra_net_dosync(struct usbnet *dev)
dev_dbg(&dev->udev->dev, "%s", __func__);
+ /* The SIERRA_NET_HIP_MSYNC_ID command appears to request that the
+ * firmware restart itself. After restarting, the modem will respond
+ * with the SIERRA_NET_HIP_RESTART_ID indication. The driver continues
+ * sending MSYNC commands every few seconds until it receives the
+ * RESTART event from the firmware
+ */
+
/* tell modem we are ready */
status = sierra_net_send_sync(dev);
if (status < 0)
@@ -705,6 +712,9 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
/* set context index initially to 0 - prepares tx hdr template */
sierra_net_set_ctx_index(priv, 0);
+ /* prepare sync message template */
+ memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg));
+
/* decrease the rx_urb_size and max_tx_size to 4k on USB 1.1 */
dev->rx_urb_size = SIERRA_NET_RX_URB_SIZE;
if (dev->udev->speed != USB_SPEED_HIGH)
@@ -740,11 +750,6 @@ static int sierra_net_bind(struct usbnet *dev, struct usb_interface *intf)
kfree(priv);
return -ENODEV;
}
- /* prepare sync message from template */
- memcpy(priv->sync_msg, sync_tmplate, sizeof(priv->sync_msg));
-
- /* initiate the sync sequence */
- sierra_net_dosync(dev);
return 0;
}
@@ -767,8 +772,9 @@ static void sierra_net_unbind(struct usbnet *dev, struct usb_interface *intf)
netdev_err(dev->net,
"usb_control_msg failed, status %d\n", status);
- sierra_net_set_private(dev, NULL);
+ usbnet_status_stop(dev);
+ sierra_net_set_private(dev, NULL);
kfree(priv);
}
@@ -909,6 +915,24 @@ static const struct driver_info sierra_net_info_direct_ip = {
.tx_fixup = sierra_net_tx_fixup,
};
+static int
+sierra_net_probe(struct usb_interface *udev, const struct usb_device_id *prod)
+{
+ int ret;
+
+ ret = usbnet_probe(udev, prod);
+ if (ret == 0) {
+ struct usbnet *dev = usb_get_intfdata(udev);
+
+ ret = usbnet_status_start(dev, GFP_KERNEL);
+ if (ret == 0) {
+ /* Interrupt URB now set up; initiate sync sequence */
+ sierra_net_dosync(dev);
+ }
+ }
+ return ret;
+}
+
#define DIRECT_IP_DEVICE(vend, prod) \
{USB_DEVICE_INTERFACE_NUMBER(vend, prod, 7), \
.driver_info = (unsigned long)&sierra_net_info_direct_ip}, \
@@ -931,7 +955,7 @@ MODULE_DEVICE_TABLE(usb, products);
static struct usb_driver sierra_net_driver = {
.name = "sierra_net",
.id_table = products,
- .probe = usbnet_probe,
+ .probe = sierra_net_probe,
.disconnect = usbnet_disconnect,
.suspend = usbnet_suspend,
.resume = usbnet_resume,
--
1.8.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 1/2 v5] usbnet: allow status interrupt URB to always be active
From: Dan Williams @ 2013-04-10 20:30 UTC (permalink / raw)
To: Oliver Neukum
Cc: Ming Lei, Elina Pasheva, Network Development, linux-usb,
Rory Filer, Phil Sutter
In-Reply-To: <7761183.G42DetJs5Z@linux-5eaq.site>
Some drivers (sierra_net) need the status interrupt URB
active even when the device is closed, because they receive
custom indications from firmware. Add functions to refcount
the status interrupt URB submit/kill operation so that
sub-drivers and the generic driver don't fight over whether
the status interrupt URB is active or not.
A sub-driver can call usbnet_status_start() at any time, but
the URB is only submitted the first time the function is
called. Likewise, when the sub-driver is done with the URB,
it calls usbnet_status_stop() but the URB is only killed when
all users have stopped it. The URB is still killed and
re-submitted for suspend/resume, as before, with the same
refcount it had at suspend.
Signed-off-by: Dan Williams <dcbw@redhat.com>
---
drivers/net/usb/usbnet.c | 79 ++++++++++++++++++++++++++++++++++++++++++----
include/linux/usb/usbnet.h | 5 +++
2 files changed, 77 insertions(+), 7 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 51f3192..b71ce36 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -252,6 +252,70 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf)
return 0;
}
+/* Submit the interrupt URB if not previously submitted, increasing refcount */
+int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags)
+{
+ int ret = 0;
+
+ WARN_ON_ONCE(dev->interrupt == NULL);
+ if (dev->interrupt) {
+ mutex_lock(&dev->interrupt_mutex);
+
+ if (++dev->interrupt_count == 1)
+ ret = usb_submit_urb(dev->interrupt, mem_flags);
+
+ dev_dbg(&dev->udev->dev, "incremented interrupt URB count to %d\n",
+ dev->interrupt_count);
+ mutex_unlock(&dev->interrupt_mutex);
+ }
+ return ret;
+}
+EXPORT_SYMBOL_GPL(usbnet_status_start);
+
+/* For resume; submit interrupt URB if previously submitted */
+static int __usbnet_status_start_force(struct usbnet *dev, gfp_t mem_flags)
+{
+ int ret = 0;
+
+ mutex_lock(&dev->interrupt_mutex);
+ if (dev->interrupt_count) {
+ ret = usb_submit_urb(dev->interrupt, mem_flags);
+ dev_dbg(&dev->udev->dev,
+ "submitted interrupt URB for resume\n");
+ }
+ mutex_unlock(&dev->interrupt_mutex);
+ return ret;
+}
+
+/* Kill the interrupt URB if all submitters want it killed */
+void usbnet_status_stop(struct usbnet *dev)
+{
+ if (dev->interrupt) {
+ mutex_lock(&dev->interrupt_mutex);
+ WARN_ON(dev->interrupt_count == 0);
+
+ if (dev->interrupt_count && --dev->interrupt_count == 0)
+ usb_kill_urb(dev->interrupt);
+
+ dev_dbg(&dev->udev->dev,
+ "decremented interrupt URB count to %d\n",
+ dev->interrupt_count);
+ mutex_unlock(&dev->interrupt_mutex);
+ }
+}
+EXPORT_SYMBOL_GPL(usbnet_status_stop);
+
+/* For suspend; always kill interrupt URB */
+static void __usbnet_status_stop_force(struct usbnet *dev)
+{
+ if (dev->interrupt) {
+ mutex_lock(&dev->interrupt_mutex);
+ usb_kill_urb(dev->interrupt);
+ dev_dbg(&dev->udev->dev, "killed interrupt URB for suspend\n");
+ mutex_unlock(&dev->interrupt_mutex);
+ }
+}
+
/* Passes this packet up the stack, updating its accounting.
* Some link protocols batch packets, so their rx_fixup paths
* can return clones as well as just modify the original skb.
@@ -725,7 +789,7 @@ int usbnet_stop (struct net_device *net)
if (!(info->flags & FLAG_AVOID_UNLINK_URBS))
usbnet_terminate_urbs(dev);
- usb_kill_urb(dev->interrupt);
+ usbnet_status_stop(dev);
usbnet_purge_paused_rxq(dev);
@@ -787,7 +851,7 @@ int usbnet_open (struct net_device *net)
/* start any status interrupt transfer */
if (dev->interrupt) {
- retval = usb_submit_urb (dev->interrupt, GFP_KERNEL);
+ retval = usbnet_status_start(dev, GFP_KERNEL);
if (retval < 0) {
netif_err(dev, ifup, dev->net,
"intr submit %d\n", retval);
@@ -1430,6 +1494,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
dev->delay.data = (unsigned long) dev;
init_timer (&dev->delay);
mutex_init (&dev->phy_mutex);
+ mutex_init(&dev->interrupt_mutex);
+ dev->interrupt_count = 0;
dev->net = net;
strcpy (net->name, "usb%d");
@@ -1565,7 +1631,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
*/
netif_device_detach (dev->net);
usbnet_terminate_urbs(dev);
- usb_kill_urb(dev->interrupt);
+ __usbnet_status_stop_force(dev);
/*
* reattach so runtime management can use and
@@ -1585,9 +1651,8 @@ int usbnet_resume (struct usb_interface *intf)
int retval;
if (!--dev->suspend_count) {
- /* resume interrupt URBs */
- if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
- usb_submit_urb(dev->interrupt, GFP_NOIO);
+ /* resume interrupt URB if it was previously submitted */
+ __usbnet_status_start_force(dev, GFP_NOIO);
spin_lock_irq(&dev->txq.lock);
while ((res = usb_get_from_anchor(&dev->deferred))) {
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 0e5ac93..d71f44c 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -56,6 +56,8 @@ struct usbnet {
struct sk_buff_head done;
struct sk_buff_head rxq_pause;
struct urb *interrupt;
+ unsigned interrupt_count;
+ struct mutex interrupt_mutex;
struct usb_anchor deferred;
struct tasklet_struct bh;
@@ -246,4 +248,7 @@ extern int usbnet_nway_reset(struct net_device *net);
extern int usbnet_manage_power(struct usbnet *, int);
+int usbnet_status_start(struct usbnet *dev, gfp_t mem_flags);
+void usbnet_status_stop(struct usbnet *dev);
+
#endif /* __LINUX_USB_USBNET_H */
--
1.8.1.4
^ permalink raw reply related
* Re: [PATCH] net: mv643xx_eth: use managed devm_kzalloc
From: Sergei Shtylyov @ 2013-04-10 20:26 UTC (permalink / raw)
To: Sebastian Hesselbarth
Cc: Lennert Buytenhek, Andrew Lunn, Jason Cooper, Florian Fainelli,
netdev, linux-kernel
In-Reply-To: <5165C8E4.7030401@gmail.com>
On 04/11/2013 12:17 AM, Sebastian Hesselbarth wrote:
>
>>
>>> This patch moves shared private data kzalloc to managed devm_kzalloc
>>> and
>>> cleans now unneccessary kfree and error handling.
>>>
>>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>>> ---
>>> Note that there is also an ioremap call, that could be transferred to
>>> devm_ioremap_resource. But as long as mv643xx_eth and mvmdio iomem
>>> resources overlap, this will throw -EBUSY.
>>>
>>> Cc: Lennert Buytenhek <buytenh@wantstofly.org>
>>> Cc: Andrew Lunn <andrew@lunn.ch>
>>> Cc: Jason Cooper <jason@lakedaemon.net>
>>> Cc: Florian Fainelli <florian@openwrt.org>
>>> Cc: netdev@vger.kernel.org
>>> Cc: linux-kernel@vger.kernel.org
>>> ---
>>> drivers/net/ethernet/marvell/mv643xx_eth.c | 17 ++++-------------
>>> 1 file changed, 4 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c
>>> b/drivers/net/ethernet/marvell/mv643xx_eth.c
>>> index bbe6104..955baab 100644
>>> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
>>> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
>>> @@ -2547,25 +2547,22 @@ static int mv643xx_eth_shared_probe(struct
>>> platform_device *pdev)
>>> struct mv643xx_eth_shared_private *msp;
>>> const struct mbus_dram_target_info *dram;
>>> struct resource *res;
>>> - int ret;
>>> if (!mv643xx_eth_version_printed++)
>>> pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
>>> mv643xx_eth_driver_version);
>>> - ret = -EINVAL;
>>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> if (res == NULL)
>>> - goto out;
>>> + return -EINVAL;
>>> - ret = -ENOMEM;
>>> - msp = kzalloc(sizeof(*msp), GFP_KERNEL);
>>> + msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
>>> if (msp == NULL)
>>> - goto out;
>>> + return -ENOMEM;
>>> msp->base = ioremap(res->start, resource_size(res));
>>> if (msp->base == NULL)
>>> - goto out_free;
>>> + return -EADDRNOTAVAIL;
>>
>> -ENOMEM usually.
>
> Sergei,
>
> I was looking at the example for devm_request_and_ioremap() in
> lib/devres.c. There it is -EADDRNOTAVAIL which is returned on
> failing ioremap.
This is a recommended value to return if this function fails, to be
precise --
regardless of the reason.
With mere ioremap(), the value has always been -ENOMEM.
WBR, Sergei
^ permalink raw reply
* Re: [PATCH] net: mv643xx_eth: use managed devm_kzalloc
From: Sebastian Hesselbarth @ 2013-04-10 20:17 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Lennert Buytenhek, Andrew Lunn, Jason Cooper, Florian Fainelli,
netdev, linux-kernel
In-Reply-To: <5165B264.6000605@cogentembedded.com>
On 04/10/2013 08:41 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 04/10/2013 09:38 PM, Sebastian Hesselbarth wrote:
>
>> This patch moves shared private data kzalloc to managed devm_kzalloc and
>> cleans now unneccessary kfree and error handling.
>>
>> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> ---
>> Note that there is also an ioremap call, that could be transferred to
>> devm_ioremap_resource. But as long as mv643xx_eth and mvmdio iomem
>> resources overlap, this will throw -EBUSY.
>>
>> Cc: Lennert Buytenhek <buytenh@wantstofly.org>
>> Cc: Andrew Lunn <andrew@lunn.ch>
>> Cc: Jason Cooper <jason@lakedaemon.net>
>> Cc: Florian Fainelli <florian@openwrt.org>
>> Cc: netdev@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> ---
>> drivers/net/ethernet/marvell/mv643xx_eth.c | 17 ++++-------------
>> 1 file changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c
>> b/drivers/net/ethernet/marvell/mv643xx_eth.c
>> index bbe6104..955baab 100644
>> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
>> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
>> @@ -2547,25 +2547,22 @@ static int mv643xx_eth_shared_probe(struct
>> platform_device *pdev)
>> struct mv643xx_eth_shared_private *msp;
>> const struct mbus_dram_target_info *dram;
>> struct resource *res;
>> - int ret;
>> if (!mv643xx_eth_version_printed++)
>> pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
>> mv643xx_eth_driver_version);
>> - ret = -EINVAL;
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> if (res == NULL)
>> - goto out;
>> + return -EINVAL;
>> - ret = -ENOMEM;
>> - msp = kzalloc(sizeof(*msp), GFP_KERNEL);
>> + msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
>> if (msp == NULL)
>> - goto out;
>> + return -ENOMEM;
>> msp->base = ioremap(res->start, resource_size(res));
>> if (msp->base == NULL)
>> - goto out_free;
>> + return -EADDRNOTAVAIL;
>
> -ENOMEM usually.
Sergei,
I was looking at the example for devm_request_and_ioremap() in
lib/devres.c. There it is -EADDRNOTAVAIL which is returned on
failing ioremap.
Actually, I was hoping to also use devm_ioremap_resource() for
the above, but that is too early as mv643xx_eth and mvmdio have
overlapping mem resources. Changing this will require some more
step-by-step patches that get also tested on arch/ppc and others
using platform mv643xx_eth.
But, I can send an updated patch with -ENOMEM above if required.
Sebastian
^ permalink raw reply
* [PATCH] tcp: incoming connections might use wrong route under synflood
From: Dmitry Popov @ 2013-04-10 20:09 UTC (permalink / raw)
To: David S. Miller, Alexey Kuznetsov, James Morris,
Hideaki YOSHIFUJI, Patrick McHardy
Cc: netdev, linux-kernel
There is a bug in cookie_v4_check (net/ipv4/syncookies.c):
flowi4_init_output(&fl4, 0, sk->sk_mark, RT_CONN_FLAGS(sk),
RT_SCOPE_UNIVERSE, IPPROTO_TCP,
inet_sk_flowi_flags(sk),
(opt && opt->srr) ? opt->faddr : ireq->rmt_addr,
ireq->loc_addr, th->source, th->dest);
Here we do not respect sk->sk_bound_dev_if, therefore wrong dst_entry may be taken. This dst_entry is used in new socket (get_cookie_sock -> tcp_v4_syn_recv_sock), so its packets may take wrong path. There is no such bug in ipv6 code and non-cookie code (usual case). Bugfix below.
Signed-off-by: Dmitry Popov <dp@highloadlab.com>
---
net/ipv4/syncookies.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index ef54377..397e0f6 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -349,8 +349,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
* hasn't changed since we received the original syn, but I see
* no easy way to do this.
*/
- flowi4_init_output(&fl4, 0, sk->sk_mark, RT_CONN_FLAGS(sk),
- RT_SCOPE_UNIVERSE, IPPROTO_TCP,
+ flowi4_init_output(&fl4, sk->sk_bound_dev_if, sk->sk_mark,
+ RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, IPPROTO_TCP,
inet_sk_flowi_flags(sk),
(opt && opt->srr) ? opt->faddr : ireq->rmt_addr,
ireq->loc_addr, th->source, th->dest);
^ permalink raw reply related
* Re: AMD Vi error and lost networking with r8169
From: David R @ 2013-04-10 19:57 UTC (permalink / raw)
To: Francois Romieu; +Cc: Linux Kernel Mailing List, netdev
In-Reply-To: <20130407215303.GA28778@electric-eye.fr.zoreil.com>
This is working fine so far - no further hangs, and networking seems
much faster into the bargain. Will report back if it happens again.
Thanks
David
On 07/04/13 22:53, Francois Romieu wrote:
> David R <david@unsolicited.net> :
>> I'm been seeing some problems with my new ish AMD motherboard/processor
>> combo and networking (r8169). I see the following page fault :-
>>
>> Apr 7 12:25:14 david kernel: [156421.436545] AMD-Vi: Event logged
>> [IO_PAGE_FAULT device=02:00.0 domain=0x0015 address=0x0000000000003000
>> flags=0x0050]
> Can you give the hack below a try ?
>
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 28fb50a..ed8625d 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -4125,6 +4125,8 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp)
> case RTL_GIGA_MAC_VER_23:
> case RTL_GIGA_MAC_VER_24:
> case RTL_GIGA_MAC_VER_34:
> + case RTL_GIGA_MAC_VER_35:
> + case RTL_GIGA_MAC_VER_36:
> RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST);
> break;
> default:
^ permalink raw reply
* Re: pull request: wireless-next 2013-04-10
From: David Miller @ 2013-04-10 19:51 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, netdev
In-Reply-To: <20130410171825.GB15428@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Wed, 10 Apr 2013 13:18:25 -0400
> Please accept this pull request for the 3.10 stream...
>
> Regarding the mac80211 bits, Johannes says:
>
> "Here I have a bunch of minstrel fixes from Felix, per-interface
> multicast filtering from Alex, set_tim debouncing from Ilan,
> per-interface debugfs cleanups from Stanislaw, an error return fix from
> Wei and a number of small improvements and fixes that I made myself."
>
> And for the iwlwifi bits, Johannes says:
>
> "Andrei changed an instance of kmalloc+memdup to kmemdup, Stanislaw
> removed the now unused 5ghz_disable module parameter. I also have a
> number of fixes from Ilan, Emmanuel and myself, Emmanuel also continued
> working on Bluetooth coexistence."
>
> For the sizeable batch of Bluetooth bits, Gustavo says:
>
> "This is our first batch of patches for 3.10. The biggest changes of this pull
> request are from Johan Hedberg, he implemented a HCI request framework to make
> life easier when we have to send many HCI commands and a block and wait for
> all of the to finish, we were able to fix a few issues in stack with the
> introduction of this framework.
>
> Other than that Dean Jenkins did a good work cleaning the RFCOMM code, the
> refcnt infrastructure was removed and now we use NULL pointer checks to know
> when a object was freed or not. That code was buggy and now it looks a way
> better.
>
> The rest of changes are clean ups, fixes and small improvements all over the
> Bluetooth subsystem."
>
> Regarding the wl12xx bits, Luca says:
>
> "Some patches intended for 3.10. Mostly bug fixes and other small
> improvements."
>
> On top of that, there are updates to brcmfmac, brcmsmac, b43, ssb and
> bcma, as well as mwifiex, rt2x00, and ath9k and a few others. The most
> notable bit is the addition of a new driver in the rtlwifi family.
>
> Please let me know if there are problems!
...
> git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git for-davem
Pulled, thanks John.
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2013-04-10 19:49 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) cfg80211_conn_scan() must be called with the sched_scan_mutex, fix
from Artem Savkov.
2) Fix regression in TCP ICMPv6 processing, we do not want to treat
redirects as socket errors, from Christoph Paasch.
3) Fix several recvmsg() msg_name kernel memory leaks into userspace,
in ATM, AX25, Bluetooth, CAIF, IRDA, s390 IUCV, L2TP, LLC, Netrom,
NFC, Rose, TIPC, and VSOCK. From Mathias Krause and Wei Yongjun.
4) Fix AF_IUCV handling of segmented SKBs in recvmsg(), from Ursula
Braun and Eric Dumazet.
5) CAN gw.c code does kfree() on SLAB cache memory, use
kmem_cache_free() instead. Fix from Wei Yongjun.
6) Fix LSM regression on TCP SYN/ACKs, some LSMs such as SELINUX want
an skb->sk socket context available for these packets, but nothing
else requires it. From Eric Dumazet and Paul Moore.
7) Fix ipv4 address lifetime processing so that we don't perform
sleepable acts inside of rcu_read_lock() sections, do them in an
rtnl_lock() section instead. From Jiri Pirko.
8) mvneta driver accidently sets HW features after device registry,
it should do so beforehand. Fix from Willy Tarreau.
9) Fix bonding unload races more correctly, from Nikolay Aleksandrov
and Veaceslav Falico.
10) rtnl_dump_ifinfo() and rtnl_calcit() invoke nlmsg_parse() with wrong
header size argument. Fix from Michael Riesch.
Please pull, thanks a lot!
The following changes since commit 53f63189b1110559dce8c1ee29e8abc3e31f7630:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2013-04-05 14:04:10 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
for you to fetch changes up to 6b07a24fc38476e04f591cc17594bc1835b9efdd:
lsm: add the missing documentation for the security_skb_owned_by() hook (2013-04-10 15:40:39 -0400)
----------------------------------------------------------------
Artem Savkov (1):
cfg80211: sched_scan_mtx lock in cfg80211_conn_work()
Bing Zhao (1):
mwifiex: complete last internal scan
Christoph Paasch (1):
ipv6/tcp: Stop processing ICMPv6 redirect messages
David S. Miller (3):
Merge branch 'infoleaks'
Merge branch 'wireless'
Merge branch 'fixes-for-3.9' of git://gitorious.org/linux-can/linux-can
Eric Dumazet (1):
selinux: add a skb_owned_by() hook
Franky Lin (1):
brcmfmac: do not proceed if fail to download nvram to dongle
Gabor Juhos (1):
rt2x00: rt2x00pci: fix build error on Ralink RT3x5x SoCs
Haiyang Zhang (2):
hyperv: Fix a kernel warning from netvsc_linkstatus_callback()
hyperv: Fix RNDIS send_completion code path
Hante Meuleman (3):
brcmfmac: fix tkip mic tx/rx ap swap bug.
brcmfmac: fix stopping AP.
brcmfmac: fix returning cipher_suite for get_key operation.
Jiri Pirko (2):
net: ipv4: reset check_lifetime_work after changing lifetime
net: ipv4: fix schedule while atomic bug in check_lifetime()
John W. Linville (2):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Mathias Krause (16):
atm: update msg_namelen in vcc_recvmsg()
ax25: fix info leak via msg_name in ax25_recvmsg()
Bluetooth: fix possible info leak in bt_sock_recvmsg()
Bluetooth: RFCOMM - Fix missing msg_namelen update in rfcomm_sock_recvmsg()
Bluetooth: SCO - Fix missing msg_namelen update in sco_sock_recvmsg()
caif: Fix missing msg_namelen update in caif_seqpkt_recvmsg()
irda: Fix missing msg_namelen update in irda_recvmsg_dgram()
iucv: Fix missing msg_namelen update in iucv_sock_recvmsg()
l2tp: fix info leak in l2tp_ip6_recvmsg()
llc: Fix missing msg_namelen update in llc_ui_recvmsg()
netrom: fix info leak via msg_name in nr_recvmsg()
NFC: llcp: fix info leaks via msg_name in llcp_sock_recvmsg()
rose: fix info leak via msg_name in rose_recvmsg()
tipc: fix info leaks via msg_name in recv_msg/recv_stream
VSOCK: vmci - fix possible info leak in vmci_transport_dgram_dequeue()
VSOCK: Fix missing msg_namelen update in vsock_stream_recvmsg()
Michael Riesch (1):
rtnetlink: Call nlmsg_parse() with correct header length
Neil Horman (1):
e100: Add dma mapping error check
Paul Moore (1):
lsm: add the missing documentation for the security_skb_owned_by() hook
Robert Shade (1):
ath9k: Re-enable interrupts after a channel change failure
Sridhar Samudrala (1):
sctp: remove 'sridhar' from maintainers list
Stefan Raspl (1):
qeth: fix qeth_wait_for_threads() deadlock for OSN devices
Tim Gardner (1):
rt2x00: rt2x00pci_regbusy_read() - only print register access failure once
Ursula Braun (1):
af_iucv: fix recvmsg by replacing skb_pull() function
Wei Yongjun (2):
netrom: fix invalid use of sizeof in nr_recvmsg()
can: gw: use kmem_cache_free() instead of kfree()
Yaniv Rosner (1):
bnx2x: Fix KR2 rapid link flap
Yuval Mintz (1):
bnx2x: Prevent null pointer dereference in AFEX mode
nikolay@redhat.com (2):
Revert "bonding: remove sysfs before removing devices"
bonding: fix bonding_masters race condition in bond unloading
willy tarreau (1):
net: mvneta: enable features before registering the driver
MAINTAINERS | 1 -
drivers/net/bonding/bond_main.c | 11 +++-
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 18 +++---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 3 +-
drivers/net/ethernet/intel/e100.c | 36 ++++++++----
drivers/net/ethernet/marvell/mvneta.c | 9 +--
drivers/net/hyperv/netvsc.c | 17 ++++--
drivers/net/hyperv/netvsc_drv.c | 2 -
drivers/net/hyperv/rndis_filter.c | 14 +----
drivers/net/wireless/ath/ath9k/main.c | 4 ++
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 6 +-
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 46 ++++++++-------
drivers/net/wireless/mwifiex/scan.c | 11 +++-
drivers/net/wireless/rt2x00/Kconfig | 7 +++
drivers/net/wireless/rt2x00/Makefile | 1 +
drivers/net/wireless/rt2x00/rt2400pci.c | 1 +
drivers/net/wireless/rt2x00/rt2500pci.c | 1 +
drivers/net/wireless/rt2x00/rt2800pci.c | 1 +
drivers/net/wireless/rt2x00/rt2x00mmio.c | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00mmio.h | 119 +++++++++++++++++++++++++++++++++++++
drivers/net/wireless/rt2x00/rt2x00pci.c | 176 ------------------------------------------------------
drivers/net/wireless/rt2x00/rt2x00pci.h | 88 ---------------------------
drivers/net/wireless/rt2x00/rt61pci.c | 1 +
drivers/s390/net/qeth_core.h | 3 +
drivers/s390/net/qeth_core_main.c | 19 ++++++
drivers/s390/net/qeth_l2_main.c | 2 +
drivers/s390/net/qeth_l3_main.c | 2 +
include/linux/security.h | 12 ++++
include/net/iucv/af_iucv.h | 8 +++
net/atm/common.c | 2 +
net/ax25/af_ax25.c | 1 +
net/bluetooth/af_bluetooth.c | 4 +-
net/bluetooth/rfcomm/sock.c | 1 +
net/bluetooth/sco.c | 1 +
net/caif/caif_socket.c | 2 +
net/can/gw.c | 6 +-
net/core/rtnetlink.c | 4 +-
net/ipv4/devinet.c | 60 ++++++++++++++-----
net/ipv4/tcp_output.c | 1 +
net/ipv6/tcp_ipv6.c | 1 +
net/irda/af_irda.c | 2 +
net/iucv/af_iucv.c | 36 ++++++------
net/l2tp/l2tp_ip6.c | 1 +
net/llc/af_llc.c | 2 +
net/netrom/af_netrom.c | 1 +
net/nfc/llcp/sock.c | 3 +
net/rose/af_rose.c | 1 +
net/tipc/socket.c | 7 +++
net/vmw_vsock/af_vsock.c | 2 +
net/vmw_vsock/vmci_transport.c | 3 +-
net/wireless/sme.c | 2 +
security/capability.c | 6 ++
security/security.c | 5 ++
security/selinux/hooks.c | 7 +++
54 files changed, 619 insertions(+), 377 deletions(-)
create mode 100644 drivers/net/wireless/rt2x00/rt2x00mmio.c
create mode 100644 drivers/net/wireless/rt2x00/rt2x00mmio.h
^ permalink raw reply
* Re: [PATCH] lsm: add the missing documentation for the security_skb_owned_by() hook
From: David Miller @ 2013-04-10 19:41 UTC (permalink / raw)
To: pmoore; +Cc: netdev, linux-security-module
In-Reply-To: <20130410193414.11364.7314.stgit@localhost>
From: Paul Moore <pmoore@redhat.com>
Date: Wed, 10 Apr 2013 15:34:14 -0400
> Unfortunately we didn't catch the missing comments earlier when the
> patch was merged.
>
> Signed-off-by: Paul Moore <pmoore@redhat.com>
Good timing, I was about to send Linus a pull request :-)
Applied, thanks.
^ permalink raw reply
* [PATCH] lsm: add the missing documentation for the security_skb_owned_by() hook
From: Paul Moore @ 2013-04-10 19:34 UTC (permalink / raw)
To: netdev, linux-security-module
Unfortunately we didn't catch the missing comments earlier when the
patch was merged.
Signed-off-by: Paul Moore <pmoore@redhat.com>
---
include/linux/security.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/security.h b/include/linux/security.h
index eee7478..9284c84 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1012,6 +1012,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
* This hook can be used by the module to update any security state
* associated with the TUN device's security structure.
* @security pointer to the TUN devices's security structure.
+ * @skb_owned_by:
+ * This hook sets the packet's owning sock.
+ * @skb is the packet.
+ * @sk the sock which owns the packet.
*
* Security hooks for XFRM operations.
*
^ permalink raw reply related
* Re: [PATCH net] bnx2x: Prevent null pointer dereference in AFEX mode
From: David Miller @ 2013-04-10 19:27 UTC (permalink / raw)
To: yuvalmin; +Cc: netdev, ariele, eilong
In-Reply-To: <1365590079-7422-1-git-send-email-yuvalmin@broadcom.com>
From: "Yuval Mintz" <yuvalmin@broadcom.com>
Date: Wed, 10 Apr 2013 13:34:39 +0300
> The cnic module is responsible for initializing various bnx2x structs
> via callbacks provided by the bnx2x module.
> One such struct is the queue object for the FCoE queue.
>
> If a device is working in AFEX mode and its configuration allows FCoE yet
> the cnic module is not loaded, it's very likely a null pointer dereference
> will occur, as the bnx2x will erroneously access the FCoE's queue object.
>
> Prevent said access until cnic properly registers itself.
>
> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
> Signed-off-by: Ariel Elior <ariele@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Applied, thanks.
^ permalink raw reply
* Re: [net] e100: Add dma mapping error check
From: David Miller @ 2013-04-10 19:25 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: nhorman, netdev, gospo, sassmann, jwboyer, e1000-devel
In-Reply-To: <1365585540-8199-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 10 Apr 2013 02:19:00 -0700
> From: Neil Horman <nhorman@tuxdriver.com>
>
> e100 uses pci_map_single, but fails to check for a dma mapping error after its
> use, resulting in a stack trace:
...
> Easy fix, modify the cb paramter to e100_exec_cb to return an error, and do the
> dma_mapping_error check in the obvious place
>
> This was reported previously here:
> http://article.gmane.org/gmane.linux.network/257893
>
> But nobody stepped up and fixed it.
>
> CC: Josh Boyer <jwboyer@redhat.com>
> CC: e1000-devel@lists.sourceforge.net
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> Reported-by: Michal Jaegermann <michal@harddata.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] net: mv643xx_eth: use managed devm_kzalloc
From: Sergei Shtylyov @ 2013-04-10 18:41 UTC (permalink / raw)
To: Sebastian Hesselbarth
Cc: Lennert Buytenhek, Andrew Lunn, Jason Cooper, Florian Fainelli,
netdev, linux-kernel
In-Reply-To: <1365615483-26318-1-git-send-email-sebastian.hesselbarth@gmail.com>
Hello.
On 04/10/2013 09:38 PM, Sebastian Hesselbarth wrote:
> This patch moves shared private data kzalloc to managed devm_kzalloc and
> cleans now unneccessary kfree and error handling.
>
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Note that there is also an ioremap call, that could be transferred to
> devm_ioremap_resource. But as long as mv643xx_eth and mvmdio iomem
> resources overlap, this will throw -EBUSY.
>
> Cc: Lennert Buytenhek <buytenh@wantstofly.org>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Florian Fainelli <florian@openwrt.org>
> Cc: netdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/net/ethernet/marvell/mv643xx_eth.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index bbe6104..955baab 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -2547,25 +2547,22 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
> struct mv643xx_eth_shared_private *msp;
> const struct mbus_dram_target_info *dram;
> struct resource *res;
> - int ret;
>
> if (!mv643xx_eth_version_printed++)
> pr_notice("MV-643xx 10/100/1000 ethernet driver version %s\n",
> mv643xx_eth_driver_version);
>
> - ret = -EINVAL;
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (res == NULL)
> - goto out;
> + return -EINVAL;
>
> - ret = -ENOMEM;
> - msp = kzalloc(sizeof(*msp), GFP_KERNEL);
> + msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
> if (msp == NULL)
> - goto out;
> + return -ENOMEM;
>
> msp->base = ioremap(res->start, resource_size(res));
> if (msp->base == NULL)
> - goto out_free;
> + return -EADDRNOTAVAIL;
-ENOMEM usually.
WBR, Sergei
^ permalink raw reply
* Re: [PATCH net-next] ptp: dynamic allocation of PHC char devices
From: Ben Hutchings @ 2013-04-10 18:12 UTC (permalink / raw)
To: David Miller; +Cc: jbenc, netdev, richardcochran
In-Reply-To: <20130410.134927.1751916446892581975.davem@davemloft.net>
On Wed, 2013-04-10 at 13:49 -0400, David Miller wrote:
> From: Ben Hutchings <bhutchings@solarflare.com>
> Date: Wed, 10 Apr 2013 18:37:16 +0100
>
> > On Wed, 2013-04-10 at 12:47 +0200, Jiri Benc wrote:
> >> As network adapters supporting PTP are becoming more common, machines with
> >> many NICs suddenly have many PHCs, too. The current limit of eight /dev/ptp*
> >> char devices (and thus, 8 network interfaces with PHC) is insufficient. Let
> >> the ptp driver allocate the char devices dynamically.
> >>
> >> The character devices are allocated in chunks. idr is used for tracking
> >> minor numbers allocation; the mapping from index to pointer is not used, as
> >> it is not needed for posix clocks.
> > [...]
> >
> > I don't understand why you want to dynamically allocate chunks of minor
> > numbers, rather than the full range. Unused minors don't seem to cost
> > anything.
>
> Can't multiple (unrelated) devices carve out minor space in the same
> major? Isn't that why it's designed this way?
Only at a level above the core char device functions, e.g.
misc_register() for singleton devices. Unless I'm very much mistaken,
when you allocate a char device range and specify major=0 you get a
dynamically allocated and previously unused major, regardless of how
many minors you asked for.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: Jitter and latency benchmarks with netlink / nl80211
From: Ben Greear @ 2013-04-10 18:10 UTC (permalink / raw)
To: Luis R. Rodriguez
Cc: linux-wireless, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <CAB=NE6U_0E+y8jc_0O3+9pmUyLXX9CuSMYMMWk__4Q8-+-AHTg@mail.gmail.com>
On 04/10/2013 11:05 AM, Luis R. Rodriguez wrote:
> On Wed, Apr 10, 2013 at 10:59 AM, Ben Greear <greearb@candelatech.com> wrote:
>> On 04/10/2013 10:55 AM, Luis R. Rodriguez wrote:
>>>
>>> Curious if anyone has worked on latency and jitter benchmarks in using
>>> netlink, specifically with nl80211. Has anyone benchmarked this? Ben,
>>> have you? If not for nl80211 perhaps this has been done before for
>>> other netlink families?
>>
>>
>> You mean timing related to netlink configuration/report requests?
>
> Yes.
No, I haven't bothered to do this... The way we use netlink is
mostly asynchronous..ie we just listen for events and process them
as they come in. Most of our configuration would be driven through 'iw',
'wpa_supplicant', 'ip', etc, and much of our stats gathering is through
the ethool get-stats API.
I would imagine any latency would be highly dependent on other applications
taking RTNL (for instance, creating/deleting lots of virtual stations,
mac-vlans, ip-address changes, etc).
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox