Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH RESEND] can: mcp251x: Replace power callbacks with regulator API
From: Alexander Shiyan @ 2013-08-17  4:30 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: Russell King, netdev, linux-can, Marc Kleine-Budde,
	linux-arm-kernel, Eric Miao, Wolfgang Grandegger
In-Reply-To: <520EDDA8.6050309@gmail.com>

On Sat, 17 Aug 2013 10:19:20 +0800
Haojian Zhuang <haojian.zhuang@gmail.com> wrote:

> On 08/09/2013 03:37 PM, Marc Kleine-Budde wrote:
> > On 08/08/2013 02:00 PM, Alexander Shiyan wrote:
> >> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> >> ---
> >>   arch/arm/mach-pxa/icontrol.c         |  3 --
> >>   arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------
> >
> > What's pxa's status of DT conversion? Do you (still) accept patches to
> > board files?
> >
> > Marc
> >
> 
> Since DT conversion isn't finished, I still accept the board files.
> But this patch should be split into two parts. One is for pxa, and the
> other one is for net.

Patch cannot be splitted because this can create hole which break git-bisect.

In any case, I want to create a v2 with a more detailed description, and I
have a supplementary question for the CAN subsystem maintainers.
"Transciever power" is not used by any of the boards, can we remove it
completely? This will greatly simplify driver.
Thanks.

-- 
Alexander Shiyan <shc_work@mail.ru>

^ permalink raw reply

* Re: [PATCH 0/3] ixgbe: request_firmware for configuration parameters
From: Greg KH @ 2013-08-17  4:31 UTC (permalink / raw)
  To: Ali Ayoub
  Cc: Shannon Nelson, netdev, davem, dwmw2, jeffrey.t.kirsher,
	linux-kernel
In-Reply-To: <520EC144.5090505@dev.mellanox.co.il>

On Fri, Aug 16, 2013 at 05:18:12PM -0700, Ali Ayoub wrote:
> On 8/16/2013 3:39 PM, Greg KH wrote:
> > On Fri, Aug 16, 2013 at 03:14:31PM -0700, Ali Ayoub wrote:
> >> On 1/11/2013 11:41 AM, Greg KH wrote:
> > 
> > Seriously?  Restarting a thread from over 6 months ago?
> 
> Yes, it's an old thread, but still relevant for current code.

Which specific code are you referring to?

> > Why?
> 
> Because currently there is no good alternative for module params for
> device drivers that need to have low level configs in init time.

I disagree, see below for why module params are broken for this.

> >> Other device drivers of other vendors (not only netdevs) need such a
> >> mechanism as well,
> > 
> > Specifics please.
> >
> >> I think it's a general requirement for many drivers that normally need
> >> low level configurations for device initialization in the very first
> >> stage of the driver load.
> > 
> > I do not, but feel free to prove me otherwise.
> 
> A driver that claims the PCI device needs some configuration in init
> time such as: amount of resources to be allocated in the cache,
> interrupt mode, maximum allowed resources to be created for a specific
> type, number of event queues, etc. See for example:
> /drivers/net/ethernet/mellanox/mlx4/main.c
> 
> This driver doesn't necessary register a logical device, it may claim
> the PCI device only (e.g. for an HCA), and provide an infrastructure for
> upper layer protocols to register a logical device (nic, hba, etc.) on
> top of it.

And how do you handle hundreds of the same card in the same machine?
You can't do that with module paramaters at all, it doesn't scale, or
make any sense.

What about hotplug of new devices after the module is loaded?  That will
not work at all for module parameters either.

That is why we created sysfs, and configfs.

> The type of configuration needed varies between vendors, and they are
> normally passed in HW initialization stage. So even if we have a tool to
> configure the device (such as ethtool for netdevs) it wouldn't be a
> replacement for the module param, because some systems requires
> non-default (init) configurations, and if we load the driver with the
> default, and then use a user-space tool to "adjust" the configuration
> we'll have a "glitch" where the driver was loaded with unsuitable
> configs for the system.

No, just remain in a "unusable" state until you are initialized from
userspace.  No "glitch" at all.

> >>> All of the above issues you seem to have with sysfs and configfs can be
> >>> resolved with userspace code, and having your driver not do anything to
> >>> the hardware until it is told to by userspace.
> >>
> >> To tell the driver not to do anything until it's configured by a
> >> userspace code will require a module param for non-default-configs
> >> (which brings us back to the original argument of avoiding module params).
> > 
> > No, never use a module paramater for configuring a driver or a device.
> > That's not what they are there for.
> >
> >> By having userspace code to feed configfs/sysfs nodes, and making it
> >> available in initrd; we will end up having similar mechanism to
> >> request_firmware().
> > 
> > Close, but not the same.  That's why we created configfs, please use it.
> 
> configfs requires from the driver to provide the hooks before the HW is
> initialized, while module params allow passing information to the driver
> in init time before any driver hooks are ready.

And module params don't work at all for the common usage of hotplug
devices, and multiple numbers of devices that show up _after_ the module
is loaded.

> The proposal of changing the driver not to configure the HW until it's
> triggered by userspace service through configfs, means that we need:
> 
> a. To have driver config to toggle between the mode where the driver
> "waits" for configfs, and the "auto" mode where the driver loads with
> the default-configs (when using mod params for example, the driver
> simply loads with the defaults when there is modprobe config files).
> 
> b. To have the userspace mechanism to feed the configs nodes, to store
> the configs in a file to keep them persistent between reboots, and make
> these userspace services available in initrd.

Does this really need to be in the initrd?  That's only needed for your
boot device, and if you need it there, great, put it there, that's what
dracut is there for, it's a full Linux system in the initrd.

configfs, for complex initializations like you are proposing, works,
that is why it was created, and what it is used for.  Yes, it's "rough"
in places, and a bit complex.  Patches to fix that are always gladly
appreciated.

> I don't see how this is better than module params, or
> request_firmware_config().

request_firmware is for just that, firmware, not configuration values,
sorry.  Use configfs for configuration, that's what it is there for.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH RESEND] can: mcp251x: Replace power callbacks with regulator API
From: Haojian Zhuang @ 2013-08-17  4:37 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: Marc Kleine-Budde, Eric Miao, netdev, linux-can,
	Wolfgang Grandegger, Russell King,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <20130817083014.a01144051b158c34ec7dd9d9@mail.ru>

On Sat, Aug 17, 2013 at 12:30 PM, Alexander Shiyan <shc_work@mail.ru> wrote:
> On Sat, 17 Aug 2013 10:19:20 +0800
> Haojian Zhuang <haojian.zhuang@gmail.com> wrote:
>
>> On 08/09/2013 03:37 PM, Marc Kleine-Budde wrote:
>> > On 08/08/2013 02:00 PM, Alexander Shiyan wrote:
>> >> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
>> >> ---
>> >>   arch/arm/mach-pxa/icontrol.c         |  3 --
>> >>   arch/arm/mach-pxa/zeus.c             | 46 ++++++++++----------
>> >
>> > What's pxa's status of DT conversion? Do you (still) accept patches to
>> > board files?
>> >
>> > Marc
>> >
>>
>> Since DT conversion isn't finished, I still accept the board files.
>> But this patch should be split into two parts. One is for pxa, and the
>> other one is for net.
>
> Patch cannot be splitted because this can create hole which break git-bisect.
>
> In any case, I want to create a v2 with a more detailed description, and I
> have a supplementary question for the CAN subsystem maintainers.
> "Transciever power" is not used by any of the boards, can we remove it
> completely? This will greatly simplify driver.
> Thanks.
>
> --
> Alexander Shiyan <shc_work@mail.ru>

If you want to make the patch go through pxa tree, you need to get the Ack
from CAN maintainer.

Regards
Haojian

^ permalink raw reply

* Re: [PATCH] vhost: Drop linux/socket.h
From: David Miller @ 2013-08-17  5:29 UTC (permalink / raw)
  To: asias; +Cc: netdev, virtualization, kvm, mst
In-Reply-To: <20130816092743.GA9918@hj.localdomain>

From: Asias He <asias@redhat.com>
Date: Fri, 16 Aug 2013 17:27:43 +0800

> On Fri, Aug 16, 2013 at 12:31:59AM -0700, David Miller wrote:
>> From: Asias He <asias@redhat.com>
>> Date: Fri, 16 Aug 2013 09:27:43 +0800
>> 
>> > On Thu, Aug 15, 2013 at 02:07:40PM -0700, David Miller wrote:
>> >> From: Asias He <asias@redhat.com>
>> >> Date: Thu, 15 Aug 2013 11:20:16 +0800
>> >> 
>> >> > memcpy_fromiovec is moved to lib/iovec.c. No need to include
>> >> > linux/socket.h for it.
>> >> > 
>> >> > Signed-off-by: Asias He <asias@redhat.com>
>> >> 
>> >> You can't do this.
>> >> 
>> >> Because this file doesn't include the header file that
>> >> provides the declaration, which is linux/uio.h
>> > 
>> > vhost.c includes drivers/vhost/vhost.h. In drivers/vhost/vhost.h, we
>> > have linux/uio.h included.
>> 
>> Nothing in vhost.h needs linux/uio.h right?  That's very poor style,
>> include the header where the dependency exists which is vhost.c
> 
> We use 'struct iovec' in vhost.h which needs linux/uio.h, no?
> 
> So, how about including linux/uio.h in both vhost.c and vhost.h.

That sounds good.

^ permalink raw reply

* Re: [PATCH] driver:net:stmmac: Disable DMA store and forward mode if platform data force_sf_dma_mode is negative.
From: David Miller @ 2013-08-17  5:30 UTC (permalink / raw)
  To: sonic.adi; +Cc: peppe.cavallaro, netdev, adi-buildroot-devel, sonic.zhang
In-Reply-To: <CAJxxZ0Pya_K-VJcAZ6yv00_F66uAd481vWgV-nWmPBWKOV760A@mail.gmail.com>

From: Sonic Zhang <sonic.adi@gmail.com>
Date: Fri, 16 Aug 2013 17:37:42 +0800

> Hi David,
> 
> On Fri, Aug 16, 2013 at 5:20 AM, David Miller <davem@davemloft.net> wrote:
>> From: Sonic Zhang <sonic.adi@gmail.com>
>> Date: Thu, 15 Aug 2013 15:37:36 +0800
>>
>>> @@ -1157,7 +1157,9 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
>>>   */
>>>  static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
>>>  {
>>> -     if (likely(priv->plat->force_sf_dma_mode ||
>>> +     if (priv->plat->force_sf_dma_mode < 0)
>>> +             priv->hw->dma->dma_mode(priv->ioaddr, tc, tc);
>>> +     else if (likely(priv->plat->force_sf_dma_mode > 0 ||
>>>                  ((priv->plat->tx_coe) && (!priv->no_csum_insertion)))) {
>>
>> You need to properly re-indent the last line here so that
>> the openning parenthesis lines up with the first column
>> after the openning parenthesis on the "else if" line.
> 
> The last line is the original source code in master branch of the
> Linus's kernel git tree. Do you mean I should fix the ident issue in
> this patch as well?

I'm saying that, in your patch, the second line in

+     else if (likely(priv->plat->force_sf_dma_mode > 0 ||
                 ((priv->plat->tx_coe) && (!priv->no_csum_insertion)))) {

need to be reindented because you're moving the openning parenthesis
to the left by several columns, therefore the second line needs to move
the same amount.

^ permalink raw reply

* Re: [PATCH 1/2] sundance: add netconsole support
From: Denis Kirjanov @ 2013-08-17  7:08 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: netdev, davem
In-Reply-To: <1376670748-2084-1-git-send-email-kda@linux-powerpc.org>

David, please ignore these patches since they are obviously intended
for net-next.

Thanks!

On 8/16/13, Denis Kirjanov <kda@linux-powerpc.org> wrote:
> add netconsole logging support
>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
> ---
>  drivers/net/ethernet/dlink/sundance.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/net/ethernet/dlink/sundance.c
> b/drivers/net/ethernet/dlink/sundance.c
> index 50d9c63..2688a84 100644
> --- a/drivers/net/ethernet/dlink/sundance.c
> +++ b/drivers/net/ethernet/dlink/sundance.c
> @@ -469,6 +469,17 @@ static void sundance_reset(struct net_device *dev,
> unsigned long reset_cmd)
>  	}
>  }
>
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +static void sundance_poll_controller(struct net_device *dev)
> +{
> +	struct netdev_private *np = netdev_priv(dev);
> +
> +	disable_irq(np->pci_dev->irq);
> +	intr_handler(np->pci_dev->irq, dev);
> +	enable_irq(np->pci_dev->irq);
> +}
> +#endif
> +
>  static const struct net_device_ops netdev_ops = {
>  	.ndo_open		= netdev_open,
>  	.ndo_stop		= netdev_close,
> @@ -480,6 +491,9 @@ static const struct net_device_ops netdev_ops = {
>  	.ndo_change_mtu		= change_mtu,
>  	.ndo_set_mac_address 	= sundance_set_mac_addr,
>  	.ndo_validate_addr	= eth_validate_addr,
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +	.ndo_poll_controller = sundance_poll_controller,
> +#endif
>  };
>
>  static int sundance_probe1(struct pci_dev *pdev,
> --
> 1.8.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Regards,
Denis

^ permalink raw reply

* Re: [PATCH net-next 1/2] net-next: sundance: Add netconsole logging support
From: Denis Kirjanov @ 2013-08-17  7:12 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: Denis Kirjanov, netdev, davem
In-Reply-To: <520EB9E9.2020200@cogentembedded.com>

On 8/17/13, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> Hello.
>
> On 08/16/2013 09:00 PM, Denis Kirjanov wrote:
>
>     I'd rather name the patch "sundance: add netpoll support". "net-next:"
> shouldn't be there twice definitely.

Right, it was late at night so somehow I added prefix twice.
>
>> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
>> ---
>>   drivers/net/ethernet/dlink/sundance.c | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>
>> diff --git a/drivers/net/ethernet/dlink/sundance.c
>> b/drivers/net/ethernet/dlink/sundance.c
>> index 50d9c63..2688a84 100644
>> --- a/drivers/net/ethernet/dlink/sundance.c
>> +++ b/drivers/net/ethernet/dlink/sundance.c
> [...]
>> @@ -480,6 +491,9 @@ static const struct net_device_ops netdev_ops = {
>>   	.ndo_change_mtu		= change_mtu,
>>   	.ndo_set_mac_address 	= sundance_set_mac_addr,
>>   	.ndo_validate_addr	= eth_validate_addr,
>> +#ifdef CONFIG_NET_POLL_CONTROLLER
>> +	.ndo_poll_controller = sundance_poll_controller,
>
>     Could you align = here with the reset of initializers?

I'll respin.

Thanks!
>> +#endif
>
> WBR, Sergei
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
Regards,
Denis

^ permalink raw reply

* [PATCH] r8169: remember WOL preferences on driver load
From: Peter Wu @ 2013-08-17  9:00 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, Hayes Wang, Francois Romieu, lekensteyn

From: Peter Wu <lekensteyn@gmail.com>

Do not clear Broadcast/Multicast/Unicast Wake Flag or LanWake in
Config5. This is necessary to preserve WOL state when the driver is
loaded. Although the r8168 vendor driver does not write Config5 (it has
been commented out), Hayes Wang from Realtek said that masking bits like
this is more sensible.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 2943916..104eaef 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -7092,7 +7092,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	RTL_W8(Cfg9346, Cfg9346_Unlock);
 	RTL_W8(Config1, RTL_R8(Config1) | PMEnable);
-	RTL_W8(Config5, RTL_R8(Config5) & PMEStatus);
+	RTL_W8(Config5, RTL_R8(Config5) & (BWF | MWF | UWF | LanWake | PMEStatus));
 	if ((RTL_R8(Config3) & (LinkUp | MagicPacket)) != 0)
 		tp->features |= RTL_FEATURE_WOL;
 	if ((RTL_R8(Config5) & (UWF | BWF | MWF)) != 0)
-- 
1.8.3.4

^ permalink raw reply related

* [PATCH v2 net-next 1/2] sundance: Add netpoll support
From: Denis Kirjanov @ 2013-08-17  5:08 UTC (permalink / raw)
  To: netdev, davem; +Cc: Denis Kirjanov

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
v1->v2: fixed indentation issue
---
 drivers/net/ethernet/dlink/sundance.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/ethernet/dlink/sundance.c b/drivers/net/ethernet/dlink/sundance.c
index 50d9c63..bf3bf6f 100644
--- a/drivers/net/ethernet/dlink/sundance.c
+++ b/drivers/net/ethernet/dlink/sundance.c
@@ -469,6 +469,17 @@ static void sundance_reset(struct net_device *dev, unsigned long reset_cmd)
 	}
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void sundance_poll_controller(struct net_device *dev)
+{
+	struct netdev_private *np = netdev_priv(dev);
+
+	disable_irq(np->pci_dev->irq);
+	intr_handler(np->pci_dev->irq, dev);
+	enable_irq(np->pci_dev->irq);
+}
+#endif
+
 static const struct net_device_ops netdev_ops = {
 	.ndo_open		= netdev_open,
 	.ndo_stop		= netdev_close,
@@ -480,6 +491,9 @@ static const struct net_device_ops netdev_ops = {
 	.ndo_change_mtu		= change_mtu,
 	.ndo_set_mac_address 	= sundance_set_mac_addr,
 	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller 	= sundance_poll_controller,
+#endif
 };
 
 static int sundance_probe1(struct pci_dev *pdev,
-- 
1.8.0.2

^ permalink raw reply related

* [PATCH v2 net-next 2/2] sundance: Add myself as a maintainer
From: Denis Kirjanov @ 2013-08-17  5:08 UTC (permalink / raw)
  To: netdev, davem; +Cc: Denis Kirjanov
In-Reply-To: <1376716129-2533-1-git-send-email-kda@linux-powerpc.org>

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1c6f9db..a83dd4f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7973,6 +7973,12 @@ F:	arch/m68k/sun3*/
 F:	arch/m68k/include/asm/sun3*
 F:	drivers/net/ethernet/i825xx/sun3*
 
+SUNDANCE NETWORK DRIVER
+M:	Denis Kirjanov <kda@linux-powerpc.org>
+L:	netdev@vger.kernel.org
+S:	Maintained
+F:	drivers/net/ethernet/dlink/sundance.c
+
 SUPERH
 M:	Paul Mundt <lethal@linux-sh.org>
 L:	linux-sh@vger.kernel.org
-- 
1.8.0.2

^ permalink raw reply related

* [PATCH v2] r8169: fix invalid register dump
From: Peter Wu @ 2013-08-17  9:04 UTC (permalink / raw)
  To: netdev; +Cc: nic_swsd, Ben Hutchings, Francois Romieu, lekensteyn

From: Peter Wu <lekensteyn@gmail.com>

For some reason, my PCIe RTL8111E onboard NIC on a GA-Z68X-UD3H-B3
motherboard reads as FFs when reading from MMIO with a block size
larger than 7. Therefore change to reading blocks of four bytes.

Thanks to Francois for a better implementation.

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index b5eb419..2943916 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1897,12 +1897,16 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
 			     void *p)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
+	u32 __iomem *data = tp->mmio_addr;
+	u32 *dw = p;
+	int i;
 
 	if (regs->len > R8169_REGS_SIZE)
 		regs->len = R8169_REGS_SIZE;
 
 	rtl_lock_work(tp);
-	memcpy_fromio(p, tp->mmio_addr, regs->len);
+	for (i = regs->len; i > 0; i -= 4)
+		memcpy_fromio(dw++, data++, min(4, i));
 	rtl_unlock_work(tp);
 }
 
-- 
1.8.3.4

^ permalink raw reply related

* Re: [PATCH v2] r8169: fix invalid register dump
From: Ben Hutchings @ 2013-08-17 10:27 UTC (permalink / raw)
  To: Peter Wu; +Cc: netdev, nic_swsd, Francois Romieu
In-Reply-To: <1376730263-9352-1-git-send-email-lekensteyn@gmail.com>

On Sat, 2013-08-17 at 11:04 +0200, Peter Wu wrote:
> From: Peter Wu <lekensteyn@gmail.com>
> 
> For some reason, my PCIe RTL8111E onboard NIC on a GA-Z68X-UD3H-B3
> motherboard reads as FFs when reading from MMIO with a block size
> larger than 7. Therefore change to reading blocks of four bytes.
> 
> Thanks to Francois for a better implementation.
> 
> Signed-off-by: Peter Wu <lekensteyn@gmail.com>
> ---
>  drivers/net/ethernet/realtek/r8169.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index b5eb419..2943916 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -1897,12 +1897,16 @@ static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
>  			     void *p)
>  {
>  	struct rtl8169_private *tp = netdev_priv(dev);
> +	u32 __iomem *data = tp->mmio_addr;
> +	u32 *dw = p;
> +	int i;
>  
>  	if (regs->len > R8169_REGS_SIZE)
>  		regs->len = R8169_REGS_SIZE;
>  
>  	rtl_lock_work(tp);
> -	memcpy_fromio(p, tp->mmio_addr, regs->len);
> +	for (i = regs->len; i > 0; i -= 4)
> +		memcpy_fromio(dw++, data++, min(4, i));

I would be very wary of accessing registers with any width other than
the usual (32 bits).

And as I said, the kernel buffer is always large enough for all your
registers, so this could just be:

	for (i = 0; i < R8169_REGS_SIZE; i += 4)
		memcpy_fromio(dw++, data++, 4);

Ben.

>  	rtl_unlock_work(tp);
>  }
>  

-- 
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

* [PATCH] batman-adv: properly end seq_read session
From: Antonio Quartulli @ 2013-08-17 10:34 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli
In-Reply-To: <1376735694-676-1-git-send-email-ordex@autistici.org>

A missing skb_abort_seq_read() has to be added in order to
properly close the seq_read session initiated with
skb_prepare_seq_read().

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 08125f3..51aafd6 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -473,6 +473,7 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr)
 		crc = crc32c(crc, data, len);
 		consumed += len;
 	}
+	skb_abort_seq_read(&st);
 
 	return htonl(crc);
 }
-- 
1.8.1.5

^ permalink raw reply related

* pull request net: 2013-08-17
From: Antonio Quartulli @ 2013-08-17 10:34 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

Hello David,

here you have another very small fix intended for net/linux-3.11.
Tha patch properly closes a seq_read session by adding an invocation to
skb_abort_seq_read().

Please pull or let me know if there is any problem.

Also, when do you plan to merge net into net-next? I have a couple of changes
for net-next which is better to apply after the merge.


Thanks a lot,
	Antonio


The following changes since commit 0f7dd1aa8f959216f1faa71513b9d3c1a9065e5a:

  Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux (2013-08-16 10:00:18 -0700)

are available in the git repository at:


  git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

for you to fetch changes up to 9863634227f1390737104f93c0748e6a7b52020e:

  batman-adv: properly end seq_read session (2013-08-17 12:23:37 +0200)

----------------------------------------------------------------
Included change:
- Add a missing skb_abort_seq_read() to properly close seq_read session

----------------------------------------------------------------
Antonio Quartulli (1):
      batman-adv: properly end seq_read session

 net/batman-adv/main.c | 1 +
 1 file changed, 1 insertion(+)n-Reply-To: 

Hello David,

here you have another very small fix for net/linux-3.11.
Tha patch properly closes a seq_read session by adding an invocation to
skb_abort_seq_read().

Please pull or let me know if there is any problem.

Also, when do you plan to merge net into net-next? I have a couple of changes
for net-next which is better to apply after the merge.


Thanks a lot,
	Antonio


The following changes since commit 0f7dd1aa8f959216f1faa71513b9d3c1a9065e5a:

  Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux (2013-08-16 10:00:18 -0700)

are available in the git repository at:


  git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

for you to fetch changes up to 9863634227f1390737104f93c0748e6a7b52020e:

  batman-adv: properly end seq_read session (2013-08-17 12:23:37 +0200)

----------------------------------------------------------------
Included change:
- Add a missing skb_abort_seq_read() to properly close seq_read session

----------------------------------------------------------------
Antonio Quartulli (1):
      batman-adv: properly end seq_read session

 net/batman-adv/main.c | 1 +
 1 file changed, 1 insertion(+)

^ permalink raw reply

* Re: pull request net: 2013-08-17
From: Antonio Quartulli @ 2013-08-17 10:53 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n
In-Reply-To: <1376735694-676-1-git-send-email-ordex@autistici.org>

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

On Sat, Aug 17, 2013 at 12:34:53PM +0200, Antonio Quartulli wrote:
> Hello David,
> 
> here you have another very small fix intended for net/linux-3.11.
> Tha patch properly closes a seq_read session by adding an invocation to
> skb_abort_seq_read().
> 
> Please pull or let me know if there is any problem.
> 
> Also, when do you plan to merge net into net-next? I have a couple of changes
> for net-next which is better to apply after the merge.

Hi David,

sorry but I just realised there was another small patch to add here.
I'll re-send this pull request in a while.


Regards,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* [PATCH 2/2] batman-adv: check return type of unicast packet preparations
From: Antonio Quartulli @ 2013-08-17 11:04 UTC (permalink / raw)
  To: davem
  Cc: netdev, b.a.t.m.a.n, Linus Lüssing, Marek Lindner,
	Antonio Quartulli
In-Reply-To: <1376737486-1863-1-git-send-email-ordex@autistici.org>

From: Linus Lüssing <linus.luessing@web.de>

batadv_unicast(_4addr)_prepare_skb  might reallocate the skb's data.
And if it tries to do so then this can potentially fail.

We shouldn't continue working on this skb in such a case.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/unicast.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c
index 688a041..857e1b8 100644
--- a/net/batman-adv/unicast.c
+++ b/net/batman-adv/unicast.c
@@ -432,12 +432,16 @@ find_router:
 
 	switch (packet_type) {
 	case BATADV_UNICAST:
-		batadv_unicast_prepare_skb(skb, orig_node);
+		if (!batadv_unicast_prepare_skb(skb, orig_node))
+			goto out;
+
 		header_len = sizeof(struct batadv_unicast_packet);
 		break;
 	case BATADV_UNICAST_4ADDR:
-		batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
-						 packet_subtype);
+		if (!batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node,
+						      packet_subtype))
+			goto out;
+
 		header_len = sizeof(struct batadv_unicast_4addr_packet);
 		break;
 	default:
-- 
1.8.1.5

^ permalink raw reply related

* pull request net: 2013-08-17b
From: Antonio Quartulli @ 2013-08-17 11:04 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

Hello David,

here is the correct pull request for net/linux-3.11.

As described earlier this patchset contains a change which properly ends a
seq_read cycle and another change that takes care of aborting TX operations if
the skb preparation should faile.

Please pull or let me know if there is any problem.

(about merge of net into net-next?)

Thanks a lot!
	Antonio


The following changes since commit 0f7dd1aa8f959216f1faa71513b9d3c1a9065e5a:

  Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux (2013-08-16 10:00:18 -0700)

are available in the git repository at:


  git://git.open-mesh.org/linux-merge.git tags/batman-adv-fix-for-davem

for you to fetch changes up to d823c33c0717cffea2dc73180ef780bf626908c7:

  batman-adv: check return type of unicast packet preparations (2013-08-17 12:52:27 +0200)

----------------------------------------------------------------
Included change:
- Add a missing skb_abort_seq_read() to properly close seq_read session
- Check if the skb has been correctly prepared before going on

----------------------------------------------------------------
Antonio Quartulli (1):
      batman-adv: properly end seq_read session

Linus Lüssing (1):
      batman-adv: check return type of unicast packet preparations

 net/batman-adv/main.c    |  1 +
 net/batman-adv/unicast.c | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

^ permalink raw reply

* [PATCH 1/2] batman-adv: properly end seq_read session
From: Antonio Quartulli @ 2013-08-17 11:04 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n, Antonio Quartulli
In-Reply-To: <1376737486-1863-1-git-send-email-ordex@autistici.org>

A missing skb_abort_seq_read() has to be added in order to
properly close the seq_read session initiated with
skb_prepare_seq_read().

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
 net/batman-adv/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 08125f3..51aafd6 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -473,6 +473,7 @@ __be32 batadv_skb_crc32(struct sk_buff *skb, u8 *payload_ptr)
 		crc = crc32c(crc, data, len);
 		consumed += len;
 	}
+	skb_abort_seq_read(&st);
 
 	return htonl(crc);
 }
-- 
1.8.1.5

^ permalink raw reply related

* Re: [PATCH v3 7/7] net: davinci_mdio: use platform_{get,set}_drvdata()
From: Mugunthan V N @ 2013-08-17 11:51 UTC (permalink / raw)
  To: Libo Chen
  Cc: David Miller, bigeasy, prabhakar.csengg, b-liu, netdev, LKML,
	Li Zefan, Sergei Shtylyov
In-Reply-To: <520CD13E.7090802@huawei.com>

On Thursday 15 August 2013 06:31 PM, Libo Chen wrote:
> Use the wrapper functions for getting and setting the driver data using
> platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
> so we can directly pass a struct platform_device.
>
> Signed-off-by: Libo Chen <libo.chen@huawei.com>
I had given my ack for your previous version itself, I don't know why
you didn't add my Ack in next version.
Any how

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply

* Re: [PATCH v3 00/11] Add namespace support for syslog
From: Serge E. Hallyn @ 2013-08-17 13:38 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	libo.chen-hv44wF8Li93QT0dZR+AlfA,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
	guz.fnst-BthXqXjhjHXQFUHtdCDX3A,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
In-Reply-To: <87a9kkcc38.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>

Quoting Eric W. Biederman (ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org):
> "Serge E. Hallyn" <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org> writes:
> 
> > Quoting Rui Xiang (rui.xiang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org):
> >> On 2013/8/8 9:37, Gao feng wrote:
> >> > On 08/07/2013 03:55 PM, Eric W. Biederman wrote:
> >> >>
> >> >> Since this still has not been addressed.  I am going to repeat Andrews
> >> >> objection again.
> >> >>
> >> >> Isn't there a better way to get iptables information out than to use
> >> >> syslog.  I did not have time to follow up on that but it did appear that
> >> >> someone did have a better way to get the information out.
> >> >>
> >> >> Essentially the argument against this goes.  The kernel logging facility
> >> >> is really not a particularly good tool to be using for anything other
> >> >> than kernel debugging information, and there appear to be no substantial
> >> >> uses for a separate syslog that should not be done in other ways.
> >> > 
> >> > containerizing syslog is not only for iptables, it also isolates the /dev/kmsg,
> >> > /proc/kmsg, syslog(2)... user space tools in container may use this interface
> >> > to read/generate syslog.
> >> > 
> >> > But I don't know how important/urgent this containerizing syslog work is,
> >> > Rui Xiang, can you find an important/popular user space tool which uses this
> >> > interfaces to generate kernel syslog?
> >> > 
> >> 
> >> There are some other cases. Some warnings (bad mount options for tmpfs,
> >> bad uid owner for many of them, etc) emerged in the container should
> >> be exported to the container. Some belong on the host - if they show 
> >> a corrupt superblock which may indicate an attempt by the container 
> >> to crash the kernel. Like these, Kernel will print out warnings when 
> >> userspace in container uses a deprecated something or other, and these
> >> logs should be invisible and specific for current container.
> >> 
> >> I can't say this work is terribly compelling and important, but the 
> >> impact may be obvious, IMO.
> >
> > Aug  9 21:49:13 sergeh1 kernel: [4644829.672768] init: Failed to spawn network-interface (veth8Ehlvj) post-stop process: unable to change root directory: No such file ricr:aeohgrticr  cfe rty444984 n:aetswnw-ta(ht -rrsultheoit: hlrro<4865i:i sntkta(ht ttpe btheoit: hlrrob r6ezt)nrgoadgte644915 c0pt(tyg ti wd a
> > Aug  9 21:49:13 sergeh1 kernel: X3f d-6:uigitra ora
> > Aug  9 22:19:54 sergeh1 kernel: 6[642.175 X3f d-6:mutdflsse ihodrddt oe==99 rfl=lccnanrdfutwt-etn"nm=/a/ah/x/lu-ui/m.AExdu"pi=91 om=mut sye"x3name="/devlo0" lg=r"ol pmc r=3an19pfel-nireu-tntgne/rc/cldudmHEqu d97o=otfy=x"ra=d/o/fg""8b:o vhc)nrgibdte646013 veeMzWe oso d<[4715]xr r1eMc egset
> > Aug
> 
> That is certainly a mess.  Now I don't believe we allow processes in a
> user namespace to write to the kernels log (certainly we shouldn't be)
> so part of that is not a problem.

I'll have to test with user namespaces (next week - don't have a
setup right now)

However user namespaces can't be used in every case, due especially to
device restrictions and cap_capable calls.  So it may not be ok to say
"user namespaces will stop this."

> What is interleaving messages into syslog?

Heh, I'm actually not sure.  I do know it happens every time I start
a container.  I believe one of the sources is net/ipv6/addrconf.c.
Another looks like a apparmor=denied message (I say that due to the
"name=" in the garbled output).  Which would beg the question is this
actually a bug in audit.  (This is on a 3.2 kernel)  Another other may
be an upstart job relating to the nic going up.

> And to be clear my only perspective is that we need to make certain we
> have this thought out.

Agreed.  I need to test a few things as soon as I have time.

-serge

^ permalink raw reply

* [PATCH v1 00/49] USB: prepare for enabling irq in complete()
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb, Oliver Neukum, Alan Stern, linux-input,
	linux-bluetooth, netdev, linux-wireless, linux-media, alsa-devel

Hi,

As we are going to run URB->complete() in tasklet context[1][2], and
hard interrupt may be enabled when running URB completion handler[3],
so we might need to disable interrupt when acquiring one lock in
the completion handler for the below reasons:

- URB->complete() holds a subsystem wide lock which may be acquired
in another hard irq context, and the subsystem wide lock is acquired
by spin_lock()/read_lock()/write_lock() in complete()

- URB->complete() holds a private lock with spin_lock()/read_lock()/write_lock()
but driver may export APIs to make other drivers acquire the same private
lock in its interrupt handler.

For the sake of safety and making the change simple, this patch set
converts all spin_lock()/read_lock()/write_lock() in completion handler
path into their irqsave version mechanically.

But if you are sure the above two cases do not happen in your driver,
please let me know and I can drop the unnecessary change.

Also if you find some conversions are missed, also please let me know so
that I can add it in the next round.


[1], USB: URB documentation: claim complete() will be run with IRQs enabled
https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=85721d45261c4be684730c7509a59daa6cda30d8

[2], USB: HCD: support giveback of URB in tasklet context
https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=94dfd7edfd5c9b605caf7b562de7a813d216e011

[3], http://marc.info/?l=linux-usb&m=137286330626363&w=2

V1:
	- rename patchset title
	- add missed changes on 'usb_skeleon and usb sg lib'
	- remove several sound usb drivers which have been done via sound tree
	- some patch style fix
	- replace snd_pcm_stream_lock with snd_pcm_stream_lock_irqsave for related
	a/v drivers

Cc: linux-input@vger.kernel.org
Cc: linux-bluetooth@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: alsa-devel@alsa-project.org

 drivers/bluetooth/bfusb.c                     |   12 ++++----
 drivers/bluetooth/btusb.c                     |    5 ++--
 drivers/hid/usbhid/hid-core.c                 |    5 ++--
 drivers/input/misc/cm109.c                    |   10 ++++---
 drivers/isdn/hardware/mISDN/hfcsusb.c         |   36 ++++++++++++-----------
 drivers/media/dvb-core/dvb_demux.c            |   17 +++++++----
 drivers/media/usb/cx231xx/cx231xx-audio.c     |   10 ++++---
 drivers/media/usb/cx231xx/cx231xx-core.c      |   10 ++++---
 drivers/media/usb/cx231xx/cx231xx-vbi.c       |    5 ++--
 drivers/media/usb/em28xx/em28xx-audio.c       |    5 ++--
 drivers/media/usb/em28xx/em28xx-core.c        |    5 ++--
 drivers/media/usb/sn9c102/sn9c102_core.c      |    7 +++--
 drivers/media/usb/tlg2300/pd-alsa.c           |    5 ++--
 drivers/media/usb/tlg2300/pd-video.c          |    5 ++--
 drivers/media/usb/tm6000/tm6000-video.c       |    5 ++--
 drivers/net/usb/cdc-phonet.c                  |    5 ++--
 drivers/net/usb/hso.c                         |   38 ++++++++++++++-----------
 drivers/net/usb/kaweth.c                      |    7 +++--
 drivers/net/usb/rtl8150.c                     |    5 ++--
 drivers/net/wireless/ath/ath9k/hif_usb.c      |   29 ++++++++++---------
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |    9 +++---
 drivers/net/wireless/ath/ath9k/wmi.c          |   11 +++----
 drivers/net/wireless/ath/carl9170/rx.c        |    5 ++--
 drivers/net/wireless/libertas/if_usb.c        |    5 ++--
 drivers/net/wireless/libertas_tf/if_usb.c     |    6 ++--
 drivers/net/wireless/zd1211rw/zd_usb.c        |   21 ++++++++------
 drivers/staging/bcm/InterfaceRx.c             |    5 ++--
 drivers/staging/btmtk_usb/btmtk_usb.c         |    5 ++--
 drivers/staging/ced1401/usb1401.c             |   35 ++++++++++++-----------
 drivers/staging/vt6656/usbpipe.c              |    9 +++---
 drivers/usb/class/cdc-wdm.c                   |   16 +++++++----
 drivers/usb/class/usblp.c                     |   10 ++++---
 drivers/usb/core/devio.c                      |    5 ++--
 drivers/usb/core/message.c                    |    5 ++--
 drivers/usb/misc/adutux.c                     |   10 ++++---
 drivers/usb/misc/iowarrior.c                  |    5 ++--
 drivers/usb/misc/ldusb.c                      |    7 +++--
 drivers/usb/misc/legousbtower.c               |    6 ++--
 drivers/usb/misc/usbtest.c                    |   10 ++++---
 drivers/usb/misc/uss720.c                     |    7 ++++-
 drivers/usb/serial/cyberjack.c                |   15 ++++++----
 drivers/usb/serial/digi_acceleport.c          |   23 ++++++++-------
 drivers/usb/serial/io_edgeport.c              |   14 +++++----
 drivers/usb/serial/io_ti.c                    |    5 ++--
 drivers/usb/serial/mos7720.c                  |    5 ++--
 drivers/usb/serial/mos7840.c                  |    5 ++--
 drivers/usb/serial/quatech2.c                 |    5 ++--
 drivers/usb/serial/sierra.c                   |    9 +++---
 drivers/usb/serial/symbolserial.c             |    5 ++--
 drivers/usb/serial/ti_usb_3410_5052.c         |    9 +++---
 drivers/usb/serial/usb_wwan.c                 |    5 ++--
 drivers/usb/usb-skeleton.c                    |   11 ++++---
 sound/usb/caiaq/audio.c                       |    5 ++--
 sound/usb/midi.c                              |    5 ++--
 54 files changed, 318 insertions(+), 221 deletions(-)


Thanks,
--
Ming Lei


^ permalink raw reply

* [PATCH v1 29/49] USBNET: hso: prepare for enabling irq in complete()
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/hso.c |   38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index cba1d46..c865441 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1008,6 +1008,7 @@ static void read_bulk_callback(struct urb *urb)
 	struct net_device *net;
 	int result;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* is al ok?  (Filip: Who's Al ?) */
 	if (status) {
@@ -1036,11 +1037,11 @@ static void read_bulk_callback(struct urb *urb)
 	if (urb->actual_length) {
 		/* Handle the IP stream, add header and push it onto network
 		 * stack if the packet is complete. */
-		spin_lock(&odev->net_lock);
+		spin_lock_irqsave(&odev->net_lock, flags);
 		packetizeRx(odev, urb->transfer_buffer, urb->actual_length,
 			    (urb->transfer_buffer_length >
 			     urb->actual_length) ? 1 : 0);
-		spin_unlock(&odev->net_lock);
+		spin_unlock_irqrestore(&odev->net_lock, flags);
 	}
 
 	/* We are done with this URB, resubmit it. Prep the USB to wait for
@@ -1201,6 +1202,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
 {
 	struct hso_serial *serial = urb->context;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* sanity check */
 	if (!serial) {
@@ -1223,17 +1225,17 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
 		if (serial->parent->port_spec & HSO_INFO_CRC_BUG)
 			fix_crc_bug(urb, serial->in_endp->wMaxPacketSize);
 		/* Valid data, handle RX data */
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 1;
 		put_rxbuf_data_and_resubmit_bulk_urb(serial);
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 	} else if (status == -ENOENT || status == -ECONNRESET) {
 		/* Unlinked - check for throttled port. */
 		D2("Port %d, successfully unlinked urb", serial->minor);
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		serial->rx_urb_filled[hso_urb_to_index(serial, urb)] = 0;
 		hso_resubmit_rx_bulk_urb(serial, urb);
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 	} else {
 		D2("Port %d, status = %d for read urb", serial->minor, status);
 		return;
@@ -1510,12 +1512,13 @@ static void tiocmget_intr_callback(struct urb *urb)
 		DUMP(serial_state_notification,
 		     sizeof(struct hso_serial_state_notification));
 	} else {
+		unsigned long flags;
 
 		UART_state_bitmap = le16_to_cpu(serial_state_notification->
 						UART_state_bitmap);
 		prev_UART_state_bitmap = tiocmget->prev_UART_state_bitmap;
 		icount = &tiocmget->icount;
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		if ((UART_state_bitmap & B_OVERRUN) !=
 		   (prev_UART_state_bitmap & B_OVERRUN))
 			icount->parity++;
@@ -1538,7 +1541,7 @@ static void tiocmget_intr_callback(struct urb *urb)
 		   (prev_UART_state_bitmap & B_RX_CARRIER))
 			icount->dcd++;
 		tiocmget->prev_UART_state_bitmap = UART_state_bitmap;
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 		tiocmget->intr_completed = 1;
 		wake_up_interruptible(&tiocmget->waitq);
 	}
@@ -1883,8 +1886,9 @@ static void intr_callback(struct urb *urb)
 			serial = get_serial_by_shared_int_and_type(shared_int,
 								   (1 << i));
 			if (serial != NULL) {
+				unsigned long flags;
 				D1("Pending read interrupt on port %d\n", i);
-				spin_lock(&serial->serial_lock);
+				spin_lock_irqsave(&serial->serial_lock, flags);
 				if (serial->rx_state == RX_IDLE &&
 					serial->port.count > 0) {
 					/* Setup and send a ctrl req read on
@@ -1898,7 +1902,7 @@ static void intr_callback(struct urb *urb)
 					D1("Already a read pending on "
 					   "port %d or port not open\n", i);
 				}
-				spin_unlock(&serial->serial_lock);
+				spin_unlock_irqrestore(&serial->serial_lock, flags);
 			}
 		}
 	}
@@ -1925,6 +1929,7 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
 {
 	struct hso_serial *serial = urb->context;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* sanity check */
 	if (!serial) {
@@ -1932,9 +1937,9 @@ static void hso_std_serial_write_bulk_callback(struct urb *urb)
 		return;
 	}
 
-	spin_lock(&serial->serial_lock);
+	spin_lock_irqsave(&serial->serial_lock, flags);
 	serial->tx_urb_used = 0;
-	spin_unlock(&serial->serial_lock);
+	spin_unlock_irqrestore(&serial->serial_lock, flags);
 	if (status) {
 		handle_usb_error(status, __func__, serial->parent);
 		return;
@@ -1976,14 +1981,15 @@ static void ctrl_callback(struct urb *urb)
 	struct hso_serial *serial = urb->context;
 	struct usb_ctrlrequest *req;
 	int status = urb->status;
+	unsigned long flags;
 
 	/* sanity check */
 	if (!serial)
 		return;
 
-	spin_lock(&serial->serial_lock);
+	spin_lock_irqsave(&serial->serial_lock, flags);
 	serial->tx_urb_used = 0;
-	spin_unlock(&serial->serial_lock);
+	spin_unlock_irqrestore(&serial->serial_lock, flags);
 	if (status) {
 		handle_usb_error(status, __func__, serial->parent);
 		return;
@@ -1999,9 +2005,9 @@ static void ctrl_callback(struct urb *urb)
 	    (USB_DIR_IN | USB_TYPE_OPTION_VENDOR | USB_RECIP_INTERFACE)) {
 		/* response to a read command */
 		serial->rx_urb_filled[0] = 1;
-		spin_lock(&serial->serial_lock);
+		spin_lock_irqsave(&serial->serial_lock, flags);
 		put_rxbuf_data_and_resubmit_ctrl_urb(serial);
-		spin_unlock(&serial->serial_lock);
+		spin_unlock_irqrestore(&serial->serial_lock, flags);
 	} else {
 		hso_put_activity(serial->parent);
 		tty_port_tty_wakeup(&serial->port);
-- 
1.7.9.5

--
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 v1 30/49] USBNET: kaweth: prepare for enabling irq in complete()
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/kaweth.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index afb117c..4addbbf 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -598,6 +598,7 @@ static void kaweth_usb_receive(struct urb *urb)
 	struct kaweth_device *kaweth = urb->context;
 	struct net_device *net = kaweth->net;
 	int status = urb->status;
+	unsigned long flags;
 
 	int count = urb->actual_length;
 	int count2 = urb->transfer_buffer_length;
@@ -630,12 +631,12 @@ static void kaweth_usb_receive(struct urb *urb)
 		kaweth->stats.rx_errors++;
 		dev_dbg(dev, "Status was -EOVERFLOW.\n");
 	}
-	spin_lock(&kaweth->device_lock);
+	spin_lock_irqsave(&kaweth->device_lock, flags);
 	if (IS_BLOCKED(kaweth->status)) {
-		spin_unlock(&kaweth->device_lock);
+		spin_unlock_irqrestore(&kaweth->device_lock, flags);
 		return;
 	}
-	spin_unlock(&kaweth->device_lock);
+	spin_unlock_irqrestore(&kaweth->device_lock, flags);
 
 	if(status && status != -EREMOTEIO && count != 1) {
 		dev_err(&kaweth->intf->dev,
-- 
1.7.9.5

--
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 v1 31/49] USBNET: rtl8150: prepare for enabling irq in complete()
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/usb/rtl8150.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 6cbdac6..199e0fb 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -372,6 +372,7 @@ static void read_bulk_callback(struct urb *urb)
 	u16 rx_stat;
 	int status = urb->status;
 	int result;
+	unsigned long flags;
 
 	dev = urb->context;
 	if (!dev)
@@ -413,9 +414,9 @@ static void read_bulk_callback(struct urb *urb)
 	netdev->stats.rx_packets++;
 	netdev->stats.rx_bytes += pkt_len;
 
-	spin_lock(&dev->rx_pool_lock);
+	spin_lock_irqsave(&dev->rx_pool_lock, flags);
 	skb = pull_skb(dev);
-	spin_unlock(&dev->rx_pool_lock);
+	spin_unlock_irqrestore(&dev->rx_pool_lock, flags);
 	if (!skb)
 		goto resched;
 
-- 
1.7.9.5

--
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 v1 32/49] wireless: ath9k: prepare for enabling irq in complete()
From: Ming Lei @ 2013-08-17 16:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Oliver Neukum, Alan Stern,
	Ming Lei, Luis R. Rodriguez, John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1376756714-25479-1-git-send-email-ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Complete() will be run with interrupt enabled, so change to
spin_lock_irqsave().

Cc: "Luis R. Rodriguez" <mcgrof-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
Cc: "John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c      |   29 ++++++++++++++-----------
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |    9 ++++----
 drivers/net/wireless/ath/ath9k/wmi.c          |   11 +++++-----
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 6d5d716..5efc1f0 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -136,6 +136,7 @@ static void hif_usb_mgmt_cb(struct urb *urb)
 	struct cmd_buf *cmd = (struct cmd_buf *)urb->context;
 	struct hif_device_usb *hif_dev;
 	bool txok = true;
+	unsigned long flags;
 
 	if (!cmd || !cmd->skb || !cmd->hif_dev)
 		return;
@@ -155,14 +156,14 @@ static void hif_usb_mgmt_cb(struct urb *urb)
 		 * If the URBs are being flushed, no need to complete
 		 * this packet.
 		 */
-		spin_lock(&hif_dev->tx.tx_lock);
+		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
-			spin_unlock(&hif_dev->tx.tx_lock);
+			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 			dev_kfree_skb_any(cmd->skb);
 			kfree(cmd);
 			return;
 		}
-		spin_unlock(&hif_dev->tx.tx_lock);
+		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 
 		break;
 	default:
@@ -253,6 +254,7 @@ static void hif_usb_tx_cb(struct urb *urb)
 	struct tx_buf *tx_buf = (struct tx_buf *) urb->context;
 	struct hif_device_usb *hif_dev;
 	bool txok = true;
+	unsigned long flags;
 
 	if (!tx_buf || !tx_buf->hif_dev)
 		return;
@@ -272,13 +274,13 @@ static void hif_usb_tx_cb(struct urb *urb)
 		 * If the URBs are being flushed, no need to add this
 		 * URB to the free list.
 		 */
-		spin_lock(&hif_dev->tx.tx_lock);
+		spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 		if (hif_dev->tx.flags & HIF_USB_TX_FLUSH) {
-			spin_unlock(&hif_dev->tx.tx_lock);
+			spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 			ath9k_skb_queue_purge(hif_dev, &tx_buf->skb_queue);
 			return;
 		}
-		spin_unlock(&hif_dev->tx.tx_lock);
+		spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 
 		break;
 	default:
@@ -293,13 +295,13 @@ static void hif_usb_tx_cb(struct urb *urb)
 	__skb_queue_head_init(&tx_buf->skb_queue);
 
 	/* Add this TX buffer to the free list */
-	spin_lock(&hif_dev->tx.tx_lock);
+	spin_lock_irqsave(&hif_dev->tx.tx_lock, flags);
 	list_move_tail(&tx_buf->list, &hif_dev->tx.tx_buf);
 	hif_dev->tx.tx_buf_cnt++;
 	if (!(hif_dev->tx.flags & HIF_USB_TX_STOP))
 		__hif_usb_tx(hif_dev); /* Check for pending SKBs */
 	TX_STAT_INC(buf_completed);
-	spin_unlock(&hif_dev->tx.tx_lock);
+	spin_unlock_irqrestore(&hif_dev->tx.tx_lock, flags);
 }
 
 /* TX lock has to be taken */
@@ -530,8 +532,9 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 	int rx_remain_len, rx_pkt_len;
 	u16 pool_index = 0;
 	u8 *ptr;
+	unsigned long flags;
 
-	spin_lock(&hif_dev->rx_lock);
+	spin_lock_irqsave(&hif_dev->rx_lock, flags);
 
 	rx_remain_len = hif_dev->rx_remain_len;
 	rx_pkt_len = hif_dev->rx_transfer_len;
@@ -559,7 +562,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 		}
 	}
 
-	spin_unlock(&hif_dev->rx_lock);
+	spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 
 	while (index < len) {
 		u16 pkt_len;
@@ -585,7 +588,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 		index = index + 4 + pkt_len + pad_len;
 
 		if (index > MAX_RX_BUF_SIZE) {
-			spin_lock(&hif_dev->rx_lock);
+			spin_lock_irqsave(&hif_dev->rx_lock, flags);
 			hif_dev->rx_remain_len = index - MAX_RX_BUF_SIZE;
 			hif_dev->rx_transfer_len =
 				MAX_RX_BUF_SIZE - chk_idx - 4;
@@ -595,7 +598,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 			if (!nskb) {
 				dev_err(&hif_dev->udev->dev,
 					"ath9k_htc: RX memory allocation error\n");
-				spin_unlock(&hif_dev->rx_lock);
+				spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 				goto err;
 			}
 			skb_reserve(nskb, 32);
@@ -606,7 +609,7 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 
 			/* Record the buffer pointer */
 			hif_dev->remain_skb = nskb;
-			spin_unlock(&hif_dev->rx_lock);
+			spin_unlock_irqrestore(&hif_dev->rx_lock, flags);
 		} else {
 			nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
 			if (!nskb) {
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index e602c95..a6f34f8 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -1156,25 +1156,26 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb,
 	struct ath_hw *ah = priv->ah;
 	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL;
+	unsigned long flags;
 
-	spin_lock(&priv->rx.rxbuflock);
+	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
 	list_for_each_entry(tmp_buf, &priv->rx.rxbuf, list) {
 		if (!tmp_buf->in_process) {
 			rxbuf = tmp_buf;
 			break;
 		}
 	}
-	spin_unlock(&priv->rx.rxbuflock);
+	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);
 
 	if (rxbuf == NULL) {
 		ath_dbg(common, ANY, "No free RX buffer\n");
 		goto err;
 	}
 
-	spin_lock(&priv->rx.rxbuflock);
+	spin_lock_irqsave(&priv->rx.rxbuflock, flags);
 	rxbuf->skb = skb;
 	rxbuf->in_process = true;
-	spin_unlock(&priv->rx.rxbuflock);
+	spin_unlock_irqrestore(&priv->rx.rxbuflock, flags);
 
 	tasklet_schedule(&priv->rx_tasklet);
 	return;
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index 65c8894..101b771 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -207,6 +207,7 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	struct wmi *wmi = (struct wmi *) priv;
 	struct wmi_cmd_hdr *hdr;
 	u16 cmd_id;
+	unsigned long flags;
 
 	if (unlikely(wmi->stopped))
 		goto free_skb;
@@ -215,20 +216,20 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,
 	cmd_id = be16_to_cpu(hdr->command_id);
 
 	if (cmd_id & 0x1000) {
-		spin_lock(&wmi->wmi_lock);
+		spin_lock_irqsave(&wmi->wmi_lock, flags);
 		__skb_queue_tail(&wmi->wmi_event_queue, skb);
-		spin_unlock(&wmi->wmi_lock);
+		spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 		tasklet_schedule(&wmi->wmi_event_tasklet);
 		return;
 	}
 
 	/* Check if there has been a timeout. */
-	spin_lock(&wmi->wmi_lock);
+	spin_lock_irqsave(&wmi->wmi_lock, flags);
 	if (cmd_id != wmi->last_cmd_id) {
-		spin_unlock(&wmi->wmi_lock);
+		spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 		goto free_skb;
 	}
-	spin_unlock(&wmi->wmi_lock);
+	spin_unlock_irqrestore(&wmi->wmi_lock, flags);
 
 	/* WMI command response */
 	ath9k_wmi_rsp_callback(wmi, skb);
-- 
1.7.9.5

--
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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox