Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 1/3] stmmac: if force_thresh_dma_mode is set, pass tc to both txmode and rxmode in tx_hard_error_bump_tc interrupt
From: David Miller @ 2015-01-26 23:48 UTC (permalink / raw)
  To: sonic.adi; +Cc: peppe.cavallaro, netdev, adi-buildroot-devel, sonic.zhang
In-Reply-To: <1421909758-31359-1-git-send-email-sonic.adi@gmail.com>

From: Sonic Zhang <sonic.adi@gmail.com>
Date: Thu, 22 Jan 2015 14:55:56 +0800

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> Dont' pass SF_DMA_MODE to rxmode in this case.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/3] stmmac: hardware TX COE doesn't work when force_thresh_dma_mode is set
From: David Miller @ 2015-01-26 23:48 UTC (permalink / raw)
  To: sonic.adi; +Cc: peppe.cavallaro, netdev, adi-buildroot-devel, sonic.zhang
In-Reply-To: <1421909758-31359-2-git-send-email-sonic.adi@gmail.com>

From: Sonic Zhang <sonic.adi@gmail.com>
Date: Thu, 22 Jan 2015 14:55:57 +0800

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> Clear the TX COE bit when force_thresh_dma_mode is set even hardware
> dma capability says support.
> 
> Tested on BF609.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

Applied.

^ permalink raw reply

* Re: [PATCH 3/3] stmmac: Add an optional device tree property "snps,burst_len"
From: David Miller @ 2015-01-26 23:48 UTC (permalink / raw)
  To: sonic.adi; +Cc: peppe.cavallaro, netdev, adi-buildroot-devel, sonic.zhang
In-Reply-To: <1421909758-31359-3-git-send-email-sonic.adi@gmail.com>

From: Sonic Zhang <sonic.adi@gmail.com>
Date: Thu, 22 Jan 2015 14:55:58 +0800

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> This property define the AXI bug lenth.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

Applied.

^ permalink raw reply

* Re: [PATCH 1/5] PCI: Add defines for max read request sizes
From: Bjorn Helgaas @ 2015-01-27  0:20 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-pci, Matt Porter, Alexandre Bounine, Chris Metcalf,
	Bradley Grove, linux-scsi, Realtek linux nic maintainers, netdev
In-Reply-To: <1422291922-12324-1-git-send-email-zajec5@gmail.com>

On Mon, Jan 26, 2015 at 06:05:22PM +0100, Rafał Miłecki wrote:
> There are few drivers using magic numbers when operating with PCIe
> capabilities and PCI_EXP_DEVCTL_READRQ. Define known values to allow
> cleaning their code a bit.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

I applied this whole series, with acks from Alexandre and Chris, to
pci/misc for v3.20, thanks!

> ---
>  include/uapi/linux/pci_regs.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 4a1d0cc..efe3443 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -451,6 +451,10 @@
>  #define  PCI_EXP_DEVCTL_AUX_PME	0x0400	/* Auxiliary Power PM Enable */
>  #define  PCI_EXP_DEVCTL_NOSNOOP_EN 0x0800  /* Enable No Snoop */
>  #define  PCI_EXP_DEVCTL_READRQ	0x7000	/* Max_Read_Request_Size */
> +#define  PCI_EXP_DEVCTL_READRQ_128B  0x0000 /* 128 Bytes */
> +#define  PCI_EXP_DEVCTL_READRQ_256B  0x1000 /* 256 Bytes */
> +#define  PCI_EXP_DEVCTL_READRQ_512B  0x2000 /* 512 Bytes */
> +#define  PCI_EXP_DEVCTL_READRQ_1024B 0x3000 /* 1024 Bytes */
>  #define  PCI_EXP_DEVCTL_BCR_FLR 0x8000  /* Bridge Configuration Retry / FLR */
>  #define PCI_EXP_DEVSTA		10	/* Device Status */
>  #define  PCI_EXP_DEVSTA_CED	0x0001	/* Correctable Error Detected */
> -- 
> 1.8.4.5
> 

^ permalink raw reply

* Re: [PATCH v3] net: mv643xx_eth: Fix highmem support in non-TSO egress path
From: David Miller @ 2015-01-27  0:15 UTC (permalink / raw)
  To: ezequiel.garcia; +Cc: linux, netdev, B38611, fabio.estevam, David.Laight
In-Reply-To: <1421937182-1708-1-git-send-email-ezequiel.garcia@free-electrons.com>

From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Date: Thu, 22 Jan 2015 11:33:02 -0300

> Commit 69ad0dd7af22b61d9e0e68e56b6290121618b0fb
> Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Date:   Mon May 19 13:59:59 2014 -0300
> 
>     net: mv643xx_eth: Use dma_map_single() to map the skb fragments
> 
> caused a nasty regression by removing the support for highmem skb
> fragments. By using page_address() to get the address of a fragment's
> page, we are assuming a lowmem page. However, such assumption is incorrect,
> as fragments can be in highmem pages, resulting in very nasty issues.
> 
> This commit fixes this by using the skb_frag_dma_map() helper,
> which takes care of mapping the skb fragment properly. Additionally,
> the type of mapping is now tracked, so it can be unmapped using
> dma_unmap_page or dma_unmap_single when appropriate.
> 
> This commit also fixes the error path in txq_init() to release the
> resources properly.
> 
> Fixes: 69ad0dd7af22 ("net: mv643xx_eth: Use dma_map_single() to map the skb fragments")
> Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net 0/4] Fixes for sh_eth #2
From: David Miller @ 2015-01-27  0:13 UTC (permalink / raw)
  To: ben.hutchings
  Cc: netdev, linux-kernel, nobuhiro.iwamatsu.yj, mitsuhiro.kimura.kc,
	hisashi.nakamura.ak, ykaneko0929
In-Reply-To: <1421930284.1222.285.camel@xylophone.i.decadent.org.uk>

From: Ben Hutchings <ben.hutchings@codethink.co.uk>
Date: Thu, 22 Jan 2015 12:38:04 +0000

> I'm continuing review and testing of Ethernet support on the R-Car H2
> chip.  This series fixes more of the issues I've found, but it won't be
> the last set.
> 
> These are not tested on any of the other supported chips.

Series applied, thanks Ben.

^ permalink raw reply

* Re: pull-request: wireless-drivers-next 2015-01-22
From: David Miller @ 2015-01-27  0:12 UTC (permalink / raw)
  To: kvalo-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <87h9vjnic4.fsf-HodKDYzPHsUD5k0oWYwrnHL1okKdlPRT@public.gmane.org>

From: Kalle Valo <kvalo-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Date: Thu, 22 Jan 2015 13:52:11 +0200

> now a bigger pull request for net-next. Rafal found a UTF-8 bug in
> patchwork[1] and because of that two commits (d0c102f70aec and
> d0f66df5392a) have his name corrupted:
> 
>     Acked-by: Rafa? Mi?ecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Somehow I failed to spot that when I commited the patches. As rebasing
> public git trees is bad, I thought we can live with these and decided
> not to rebase. But I'll pay close attention to this in the future to
> make sure that it won't happen again. Also we requested an update to
> patchwork.kernel.org, the latest patchwork doesn't seem to have this
> bug.
> 
> Also please note this pull request also adds one DT binding doc, but
> this was reviewed in the device tree list:
> 
>  .../bindings/net/wireless/qcom,ath10k.txt          |   30 +
> 
> Please let me know if you have any issues.

Pulled, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH net-next 0/2] Minor cls_basic, act_bpf update
From: David Miller @ 2015-01-27  0:09 UTC (permalink / raw)
  To: dborkman; +Cc: jiri, netdev
In-Reply-To: <1421920699-26556-1-git-send-email-dborkman@redhat.com>

From: Daniel Borkmann <dborkman@redhat.com>
Date: Thu, 22 Jan 2015 10:58:17 +0100

> Daniel Borkmann (2):
>   net: cls_basic: return from walking on match in basic_get
>   net: act_bpf: fix size mismatch on filter preparation

Seires applied, thanks.

^ permalink raw reply

* Re: [PATCH net 0/2] Two cls_bpf fixes
From: David Miller @ 2015-01-26 23:50 UTC (permalink / raw)
  To: dborkman; +Cc: jiri, netdev
In-Reply-To: <1421919662-21066-1-git-send-email-dborkman@redhat.com>

From: Daniel Borkmann <dborkman@redhat.com>
Date: Thu, 22 Jan 2015 10:41:00 +0100

> Found them while doing a review on act_bpf and going over the
> cls_bpf code again. Will also address the first issue in act_bpf
> as it needs to be fixed there, too.

Series applied, thanks.

^ permalink raw reply

* Re: [net PATCH v2 1/1] drivers: net: cpsw: discard dual emac default vlan configuration
From: David Miller @ 2015-01-27  0:06 UTC (permalink / raw)
  To: mugunthanvnm; +Cc: netdev, stable
In-Reply-To: <1421920162-13398-1-git-send-email-mugunthanvnm@ti.com>

From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Thu, 22 Jan 2015 15:19:22 +0530

> In Dual EMAC, the default VLANs are used to segregate Rx packets between
> the ports, so adding the same default VLAN to the switch will affect the
> normal packet transfers. So returning error on addition of dual EMAC
> default VLANs.
> 
> Even if EMAC 0 default port VLAN is added to EMAC 1, it will lead to
> break dual EMAC port separations.
> 
> Fixes: d9ba8f9e6298 (driver: net: ethernet: cpsw: dual emac interface implementation)
> Cc: <stable@vger.kernel.org> # v3.9+
> Reported-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied, thanks.

^ permalink raw reply

* Anyone have working cable for Intel 40GB Ethernet NIC?
From: Ben Greear @ 2015-01-27  0:03 UTC (permalink / raw)
  To: netdev

I cannot find info on a direct-attached cable that is known to work..and the
one I bought is not accepted by the driver/NIC.

If anyone knows of a cable that works, please let me know
so I can order one.

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Re: [PATCH net-next v14 0/5] openvswitch: Introduce 128-bit unique flow identifiers.
From: David Miller @ 2015-01-26 23:46 UTC (permalink / raw)
  To: joestringer-l0M0P4e3n4LQT0dZR+AlfA
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1421887372-56414-1-git-send-email-joestringer-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>

From: Joe Stringer <joestringer@nicira.com>
Date: Wed, 21 Jan 2015 16:42:47 -0800

> This series extends the openvswitch datapath interface for flow commands to use
> 128-bit unique identifiers as an alternative to the netlink-formatted flow key.
> This significantly reduces the cost of assembling messages between the kernel
> and userspace, in particular improving Open vSwitch revalidation performance by
> 40% or more.

Series applied, thanks.
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

^ permalink raw reply

* Re: pull-request: can-next 2015-21-01
From: David Miller @ 2015-01-26 23:42 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel
In-Reply-To: <54C02F0B.7030509@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 21 Jan 2015 23:58:19 +0100

> this is a pull request of 4 patches for net-next/master.
> 
> Andri Yngvason contributes one patch to further consolidate the CAN
> state change handling. The next patch is by kbuild test robot/Fengguang
> Wu which fixes a coccinelle warning in the CAN infrastructure. The two
> last patches are by me, they remove a unused variable from the flexcan
> and at91_can driver.

Pulled, thanks Marc.

^ permalink raw reply

* Re: [PATCH 1/2] rhashtable: Introduce rhashtable_walk_*
From: Herbert Xu @ 2015-01-26 23:31 UTC (permalink / raw)
  To: David Miller
  Cc: David.Laight, tgraf, ying.xue, kaber, paulmck, netdev,
	netfilter-devel
In-Reply-To: <20150126224216.GA30551@gondor.apana.org.au>

On Tue, Jan 27, 2015 at 09:42:16AM +1100, Herbert Xu wrote:
> 
> As otherwise we'd be looking at fixing the existing users (in
> particular, nft_hash) properly which might take a lot more time.

I take that back.  Looks like my walkers would be no good for
netfilter anyway since it wants to do nested walks, meaning no
locks can be taken.

So I think I'll just have to tackle netfilter first in which case
the walk function would be no use anyway since I could just fix
netlink by itself.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: pull-request: can 2015-01-21
From: David Miller @ 2015-01-26 23:24 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can, kernel
In-Reply-To: <1421876791-31014-1-git-send-email-mkl@pengutronix.de>

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Wed, 21 Jan 2015 22:46:30 +0100

> this is a pull request for v3.19, net/master, which consists of a single patch.
> 
> Viktor Babrian fixes the issue in the c_can dirver, that the CAN interface
> might continue to send frames after the interface has been shut down.

Pulled, thanks Marc.

^ permalink raw reply

* Re: [PATCH v2] net: stmmac: add BQL support
From: David Miller @ 2015-01-26 23:22 UTC (permalink / raw)
  To: b.galvani; +Cc: peppe.cavallaro, f.fainelli, dave.taht, netdev, linux-kernel
In-Reply-To: <1421863647-20048-1-git-send-email-b.galvani@gmail.com>

From: Beniamino Galvani <b.galvani@gmail.com>
Date: Wed, 21 Jan 2015 19:07:27 +0100

> Add support for Byte Queue Limits to the STMicro MAC driver.
> 
> Tested on a Amlogic S802 quad Cortex-A9 board, where the use of BQL
> decreases the latency of a high priority ping from ~12ms to ~1ms when
> the 100Mbit link is saturated by 20 TCP streams.
> 
> Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH v3] net: mv643xx_eth: Fix highmem support in non-TSO egress path
From: Russell King - ARM Linux @ 2015-01-26 23:11 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: David Miller, netdev, B38611, fabio.estevam, David.Laight
In-Reply-To: <54C3A1F9.1000403@free-electrons.com>

On Sat, Jan 24, 2015 at 10:45:29AM -0300, Ezequiel Garcia wrote:
> Hi all,
> 
> On 01/22/2015 11:33 AM, Ezequiel Garcia wrote:
> > Commit 69ad0dd7af22b61d9e0e68e56b6290121618b0fb
> > Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> > Date:   Mon May 19 13:59:59 2014 -0300
> > 
> >     net: mv643xx_eth: Use dma_map_single() to map the skb fragments
> > 
> > caused a nasty regression by removing the support for highmem skb
> > fragments. By using page_address() to get the address of a fragment's
> > page, we are assuming a lowmem page. However, such assumption is incorrect,
> > as fragments can be in highmem pages, resulting in very nasty issues.
> > 
> > This commit fixes this by using the skb_frag_dma_map() helper,
> > which takes care of mapping the skb fragment properly. Additionally,
> > the type of mapping is now tracked, so it can be unmapped using
> > dma_unmap_page or dma_unmap_single when appropriate.
> > 
> > This commit also fixes the error path in txq_init() to release the
> > resources properly.
> > 
> > Fixes: 69ad0dd7af22 ("net: mv643xx_eth: Use dma_map_single() to map the skb fragments")
> > Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> Russell, when you have some time, please test this patch. I think it
> solves the regression and it manages to unmap the descriptors properly.

Yes, this seems to work as well, thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* RE: [PATCH v2] net: hyperv: else branch not necessary
From: Haiyang Zhang @ 2015-01-26 22:47 UTC (permalink / raw)
  To: Nicholas Mc Guire, KY Srinivasan
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
In-Reply-To: <1422209317-18975-1-git-send-email-der.herr@hofr.at>



> -----Original Message-----
> From: Nicholas Mc Guire [mailto:der.herr@hofr.at]
> Sent: Sunday, January 25, 2015 1:09 PM
> To: KY Srinivasan
> Cc: Haiyang Zhang; devel@linuxdriverproject.org; netdev@vger.kernel.org;
> linux-kernel@vger.kernel.org; Nicholas Mc Guire
> Subject: [PATCH v2] net: hyperv: else branch not necessary
> 
> As the if completes with a unconditional goto the else branch
> is not needed here.
> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Thank you!

> ---
> 
> v2: added missing subsystem string in subject line - patch unchanged
> 
> All paths of execution that did not exit through the if branch will
> go through the else branch so no need for an explicit else here
> 
> Patch was compile tested only for x86_64_defconfig + CONFIG_X86_VSMP=y
> CONFIG_HYPERV=m, CONFIG_HYPERV_NET=m
> 
> Patch is against 3.19.0-rc5 -next-20150123
> 
>  drivers/net/hyperv/rndis_filter.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/hyperv/rndis_filter.c
> b/drivers/net/hyperv/rndis_filter.c
> index 7bd8387..efb84a9 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -833,10 +833,10 @@ int rndis_filter_set_packet_filter(struct
> rndis_device *dev, u32 new_filter)
>  		 * send completion for it.
>  		 */
>  		goto exit;
> -	} else {
> -		set_complete = &request->response_msg.msg.set_complete;
> -		status = set_complete->status;
> -	}
> +	}
> +
> +	set_complete = &request->response_msg.msg.set_complete;
> +	status = set_complete->status;
> 
>  cleanup:
>  	if (request)
> --
> 1.7.10.4

^ permalink raw reply

* Re: make allyesconfig i386 build failure with next-20150122 (caused by fb_agm1264k-fl driver)
From: Greg Kroah-Hartman @ 2015-01-26 22:46 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: devel, Stephen Rothwell, isdn, netdev, linux-kernel, linux-next,
	Jim Davis
In-Reply-To: <20150126215959.GA9853@roeck-us.net>

On Mon, Jan 26, 2015 at 01:59:59PM -0800, Guenter Roeck wrote:
> On Thu, Jan 22, 2015 at 12:10:33PM -0700, Jim Davis wrote:
> > make ARCH=i386 allyesconfig fails with
> > 
> > drivers/staging/built-in.o: In function `reset':
> > (.text+0x2ae89d): multiple definition of `reset'
> > drivers/isdn/built-in.o:(.text+0x185dc2): first defined here
> > make[1]: *** [drivers/built-in.o] Error 1
> 
> Culprit:
> 
> commit b2ebd4be6fa1d2329b63531b044f9e25474981cb
> Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Date:   Wed Dec 31 10:11:10 2014 +0100
> 
>     staging: fbtft: add fb_agm1264k-fl driver
> 
> A global function named 'reset' isn't really a good idea.
> 
> Not that the global function with the same name in the isdn code
> is better ;-).

Agreed, the fbtft code is now fixed.  Patches to fix the isdn code would
be gladly accepted as well :)

thanks,

greg k-h

^ permalink raw reply

* [PATCH 2/2] net: add device_poll functionality common to all net devices
From: Xander Huff @ 2015-01-26 22:46 UTC (permalink / raw)
  To: gregkh, davem, jeff.westfahl
  Cc: netdev, linux-kernel, jaeden.amero, ben.shelton, brad.mouring,
	rich.tollerton
In-Reply-To: <1422312393-61485-1-git-send-email-xander.huff@ni.com>

From: Jeff Westfahl <jeff.westfahl@ni.com>

The device_poll feature is generic to any device. Most net devices should
be able to use a set of common functionality to implement device_poll, such
as CAP_NET_ADMIN and rtnl_lock. Add this common functionality for all net
devices to use.

This is a standalone feature that should be submitted for review and
possible inclusion in mainline, or maybe in the RT patch.

Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
---
 include/linux/netdev_poll.h | 26 ++++++++++++++++++
 net/Kconfig                 |  3 +++
 net/core/Makefile           |  1 +
 net/core/dev_poll.c         | 64 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 94 insertions(+)
 create mode 100644 include/linux/netdev_poll.h
 create mode 100644 net/core/dev_poll.c

diff --git a/include/linux/netdev_poll.h b/include/linux/netdev_poll.h
new file mode 100644
index 0000000..3785454
--- /dev/null
+++ b/include/linux/netdev_poll.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 National Instruments Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_NETDEV_POLL_H_
+#define _LINUX_NETDEV_POLL_H_
+
+#ifdef CONFIG_NETDEV_POLL
+
+#include <linux/device_poll.h>
+
+int netdev_poll_init(struct device_poll *device_poll);
+
+#endif
+
+#endif /* _LINUX_NETDEV_POLL_H_ */
diff --git a/net/Kconfig b/net/Kconfig
index a073148..6e6ec69 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -324,5 +324,8 @@ source "net/caif/Kconfig"
 source "net/ceph/Kconfig"
 source "net/nfc/Kconfig"
 
+config NETDEV_POLL
+	bool
+	select DEVICE_POLL
 
 endif   # if NET
diff --git a/net/core/Makefile b/net/core/Makefile
index 0d357b1..4255163 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_FIB_RULES) += fib_rules.o
 obj-$(CONFIG_TRACEPOINTS) += net-traces.o
 obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o
 obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o
+obj-$(CONFIG_NETDEV_POLL) += dev_poll.o
diff --git a/net/core/dev_poll.c b/net/core/dev_poll.c
new file mode 100644
index 0000000..1f2d455
--- /dev/null
+++ b/net/core/dev_poll.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014 National Instruments Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/netdev_poll.h>
+#include <linux/netdevice.h>
+#include <linux/rtnetlink.h>
+
+/* netdev_poll internal functions */
+
+static int netdev_poll_reinit(struct device_poll *device_poll)
+{
+	int ret = 0;
+	struct net_device *netdev = to_net_dev(device_poll->device);
+
+	if (netif_running(netdev)) {
+		netdev->netdev_ops->ndo_stop(netdev);
+		ret = netdev->netdev_ops->ndo_open(netdev);
+	}
+
+	return ret;
+}
+
+static void netdev_poll_lock(struct device_poll *device_poll)
+{
+	rtnl_lock();
+}
+
+static void netdev_poll_unlock(struct device_poll *device_poll)
+{
+	rtnl_unlock();
+}
+
+/* netdev_poll external functions */
+
+int netdev_poll_init(struct device_poll *device_poll)
+{
+	if (!device_poll || !device_poll->device || !device_poll->ops)
+		return -EINVAL;
+
+	if (!device_poll->ops->reinit)
+		device_poll->ops->reinit = netdev_poll_reinit;
+	if (!device_poll->ops->lock)
+		device_poll->ops->lock = netdev_poll_lock;
+	if (!device_poll->ops->unlock)
+		device_poll->ops->unlock = netdev_poll_unlock;
+
+	/* Allow changes from any process with CAP_NET_ADMIN. */
+	device_poll->use_capability = 1;
+	device_poll->capability = CAP_NET_ADMIN;
+
+	return device_poll_init(device_poll);
+}
+EXPORT_SYMBOL(netdev_poll_init);
-- 
1.9.1

^ permalink raw reply related

* [PATCH 1/2] driver core: add device_poll interface
From: Xander Huff @ 2015-01-26 22:46 UTC (permalink / raw)
  To: gregkh, davem, jeff.westfahl
  Cc: netdev, linux-kernel, jaeden.amero, ben.shelton, brad.mouring,
	rich.tollerton

From: Jeff Westfahl <jeff.westfahl@ni.com>

Add the device_poll interface to the driver core. This is a generic
interface that any struct device can take advantage of to dynamically
switch between using interrupts and polling. Many drivers can be easily
modified to take advantage of this feature if desired.

This interface is most likely to be used along with the RT patch. It has
only been used thus far on Ethernet interfaces. Even with the standard
RT change to threaded interrupts for all devices, some RT applications
can be sensitive to even the minimal hardware interrupt that still occurs
with threaded interrupt handlers. The device_poll interface can be used
to completely eliminate all hardware interrupts for a device and the
associated jitter.

This is a standalone feature that should be submitted for review and
possible inclusion in mainline, or maybe in the RT patch.

Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
---
 drivers/base/Kconfig        |   3 +
 drivers/base/Makefile       |   1 +
 drivers/base/poll.c         | 327 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/device_poll.h | 105 ++++++++++++++
 4 files changed, 436 insertions(+)
 create mode 100644 drivers/base/poll.c
 create mode 100644 include/linux/device_poll.h

diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 21cf46f..d23df71 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -174,4 +174,7 @@ config SYS_HYPERVISOR
 
 source "drivers/base/regmap/Kconfig"
 
+config DEVICE_POLL
+	bool
+
 endmenu
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 99a375a..92ab7f3 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_MODULES)	+= module.o
 endif
 obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o
 obj-$(CONFIG_REGMAP)	+= regmap/
+obj-$(CONFIG_DEVICE_POLL) += poll.o
 
 ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
 
diff --git a/drivers/base/poll.c b/drivers/base/poll.c
new file mode 100644
index 0000000..911a296
--- /dev/null
+++ b/drivers/base/poll.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2014 National Instruments Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/device_poll.h>
+#include <linux/device.h>
+#include <linux/sysfs.h>
+#include <linux/sched.h>
+#include <linux/stat.h>
+#include <linux/kthread.h>
+#include <linux/delay.h>
+
+/* sysfs attributes */
+
+#define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr)
+
+/* get sysfs attributes */
+
+ssize_t device_poll_get_interval(struct device *dev,
+				 struct device_attribute *attr, char *buf)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+	struct device_poll *device_poll = ea->var;
+
+	return sprintf(buf, "%d\n", device_poll->interval);
+}
+
+static ssize_t device_poll_get_policy(struct device *dev,
+				      struct device_attribute *attr, char *buf)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+	struct device_poll *device_poll = ea->var;
+
+	switch (device_poll->policy) {
+	case SCHED_NORMAL:
+		return sprintf(buf, "SCHED_NORMAL (SCHED_OTHER)\n");
+	case SCHED_FIFO:
+		return sprintf(buf, "SCHED_FIFO\n");
+	case SCHED_RR:
+		return sprintf(buf, "SCHED_RR\n");
+	case SCHED_BATCH:
+		return sprintf(buf, "SCHED_BATCH\n");
+	case SCHED_IDLE:
+		return sprintf(buf, "SCHED_IDLE\n");
+	default:
+		return sprintf(buf, "unknown\n");
+	}
+}
+
+static ssize_t device_poll_get_priority(struct device *dev,
+					struct device_attribute *attr,
+					char *buf)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+	struct device_poll *device_poll = ea->var;
+
+	return sprintf(buf, "%d\n", device_poll->priority);
+}
+
+/* set sysfs attributes */
+
+static ssize_t device_poll_set_interval(struct device *dev,
+					struct device_attribute *attr,
+					const char *buf, size_t size)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+	struct device_poll *device_poll = ea->var;
+	int interval;
+	int ret = 0;
+
+	if (device_poll->use_capability && !capable(device_poll->capability))
+		return -EPERM;
+
+	if (0 > kstrtoint(buf, 0, &interval))
+		return -EINVAL;
+
+	device_poll->ops->lock(device_poll);
+	if (device_poll->interval != interval) {
+		device_poll->interval = interval;
+
+		ret = device_poll->ops->reinit(device_poll);
+	}
+	device_poll->ops->unlock(device_poll);
+
+	if (ret)
+		return ret;
+
+	return size;
+}
+
+static ssize_t device_poll_set_policy(struct device *dev,
+				      struct device_attribute *attr,
+				      const char *buf, size_t size)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+	struct device_poll *device_poll = ea->var;
+	char policy_str[16] = { 0 };
+	int policy;
+	struct sched_param param;
+
+	if (device_poll->use_capability && !capable(device_poll->capability))
+		return -EPERM;
+
+	if (1 != sscanf(buf, "%15s", policy_str))
+		return -EINVAL;
+
+	if ((0 == strcmp(policy_str, "SCHED_NORMAL") ||
+	     (0 == strcmp(policy_str, "SCHED_OTHER"))))
+		policy = SCHED_NORMAL;
+	else if (0 == strcmp(policy_str, "SCHED_FIFO"))
+		policy = SCHED_FIFO;
+	else if (0 == strcmp(policy_str, "SCHED_RR"))
+		policy = SCHED_RR;
+	else if (0 == strcmp(policy_str, "SCHED_BATCH"))
+		policy = SCHED_BATCH;
+	else if (0 == strcmp(policy_str, "SCHED_IDLE"))
+		policy = SCHED_IDLE;
+	else
+		return -EINVAL;
+
+	device_poll->ops->lock(device_poll);
+	if (device_poll->policy != policy) {
+		device_poll->policy = policy;
+
+		if (device_poll->task) {
+			param.sched_priority = device_poll->priority;
+			sched_setscheduler(device_poll->task,
+					   device_poll->policy,
+					   &param);
+		}
+	}
+	device_poll->ops->unlock(device_poll);
+
+	return size;
+}
+
+static ssize_t device_poll_set_priority(struct device *dev,
+					struct device_attribute *attr,
+					const char *buf, size_t size)
+{
+	struct dev_ext_attribute *ea = to_ext_attr(attr);
+	struct device_poll *device_poll = ea->var;
+	int priority;
+	struct sched_param param;
+
+	if (device_poll->use_capability && !capable(device_poll->capability))
+		return -EPERM;
+
+	if (0 > kstrtoint(buf, 0, &priority))
+		return -EINVAL;
+
+	device_poll->ops->lock(device_poll);
+	if (device_poll->priority != priority) {
+		device_poll->priority = priority;
+
+		if (device_poll->task) {
+			param.sched_priority = device_poll->priority;
+			sched_setscheduler(device_poll->task,
+					   device_poll->policy,
+					   &param);
+		}
+	}
+	device_poll->ops->unlock(device_poll);
+
+	return size;
+}
+
+/* sysfs attributes */
+
+static const DEVICE_ATTR(interval, S_IWUSR | S_IRUGO,
+			 device_poll_get_interval, device_poll_set_interval);
+
+static const DEVICE_ATTR(policy, S_IWUSR | S_IRUGO,
+			 device_poll_get_policy, device_poll_set_policy);
+
+static const DEVICE_ATTR(priority, S_IWUSR | S_IRUGO,
+			 device_poll_get_priority, device_poll_set_priority);
+
+/* device_poll internal functions */
+
+static int device_poll_thread(void *info)
+{
+	struct device_poll *device_poll = info;
+	int polling_interval;
+	int polling_interval_us;
+	struct sched_param param;
+
+	polling_interval = device_poll->interval;
+
+	/* If we got changed to interrupt mode before the polling thread
+	   started. */
+	if (unlikely(0 >= polling_interval)) {
+		while (!kthread_should_stop())
+			usleep(1);
+		return -EINTR;
+	}
+
+	polling_interval_us = polling_interval * 1000;
+
+	param.sched_priority = device_poll->priority;
+	sched_setscheduler(current, device_poll->policy, &param);
+
+	while (!kthread_should_stop()) {
+		/* Ensure changes to device_poll->enabled made on other CPUs
+		   are seen here. */
+		smp_rmb();
+		if (device_poll->enabled)
+			device_poll->ops->interrupt(device_poll);
+
+		if (20 > polling_interval)
+			usleep_range(polling_interval_us, polling_interval_us);
+		else
+			msleep(polling_interval);
+	}
+
+	return 0;
+}
+
+/* device_poll external functions */
+
+int device_poll_init(struct device_poll *device_poll)
+{
+	int ret;
+
+	if (!device_poll || !device_poll->device || !device_poll->ops)
+		return -EINVAL;
+
+	if (!device_poll->ops->reinit || !device_poll->ops->lock ||
+	    !device_poll->ops->unlock || !device_poll->ops->interrupt)
+		return -EINVAL;
+
+	if (device_poll->use_capability && !cap_valid(device_poll->capability))
+		return -EINVAL;
+
+	device_poll->task = NULL;
+	device_poll->enabled = 0;
+
+	device_poll->interval_attr.attr = dev_attr_interval;
+	device_poll->policy_attr.attr = dev_attr_policy;
+	device_poll->priority_attr.attr = dev_attr_priority;
+
+	device_poll->interval_attr.var = device_poll;
+	device_poll->policy_attr.var = device_poll;
+	device_poll->priority_attr.var = device_poll;
+
+	if (device_poll->use_capability) {
+		device_poll->interval_attr.attr.attr.mode |= S_IWUGO;
+		device_poll->policy_attr.attr.attr.mode |= S_IWUGO;
+		device_poll->priority_attr.attr.attr.mode |= S_IWUGO;
+	}
+
+	sysfs_attr_init(&device_poll->interval_attr.attr.attr);
+	sysfs_attr_init(&device_poll->policy_attr.attr.attr);
+	sysfs_attr_init(&device_poll->priority_attr.attr.attr);
+
+	device_poll->attrs[0] = &device_poll->interval_attr.attr.attr;
+	device_poll->attrs[1] = &device_poll->policy_attr.attr.attr;
+	device_poll->attrs[2] = &device_poll->priority_attr.attr.attr;
+	device_poll->attrs[3] = NULL;
+
+	device_poll->attr_group.name = "device_poll";
+	device_poll->attr_group.attrs = device_poll->attrs;
+
+	ret = sysfs_create_group(&device_poll->device->kobj,
+				 &device_poll->attr_group);
+	if (ret)
+		device_poll_exit(device_poll);
+
+	return ret;
+}
+EXPORT_SYMBOL(device_poll_init);
+
+void device_poll_exit(struct device_poll *device_poll)
+{
+	if (!device_poll || !device_poll->device)
+		return;
+
+	sysfs_remove_group(&device_poll->device->kobj,
+			   &device_poll->attr_group);
+}
+EXPORT_SYMBOL(device_poll_exit);
+
+int device_poll_request_irq(struct device_poll *device_poll)
+{
+	int err;
+
+	if (!device_poll)
+		return -EINVAL;
+
+	/* If interrupts are enabled. */
+	if (device_poll->interval <= 0)
+		return -ERANGE;
+
+	/* Start up the polling thread. */
+	device_poll->task = kthread_run(device_poll_thread,
+					device_poll, "poll/%s",
+					dev_name(device_poll->device));
+	if (IS_ERR(device_poll->task)) {
+		err = PTR_ERR(device_poll->task);
+		device_poll->task = NULL;
+		dev_err(device_poll->device,
+			"Unable to create polling thread: %d\n", err);
+		return err;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(device_poll_request_irq);
+
+void device_poll_free_irq(struct device_poll *device_poll)
+{
+	if (device_poll_is_active(device_poll)) {
+		kthread_stop(device_poll->task);
+		device_poll->task = NULL;
+	}
+}
+EXPORT_SYMBOL(device_poll_free_irq);
diff --git a/include/linux/device_poll.h b/include/linux/device_poll.h
new file mode 100644
index 0000000..846a3b4
--- /dev/null
+++ b/include/linux/device_poll.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2014 National Instruments Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_DEVICE_POLL_H_
+#define _LINUX_DEVICE_POLL_H_
+
+#ifdef CONFIG_DEVICE_POLL
+
+#include <linux/device.h>
+
+struct device_poll;
+
+struct device_poll_ops {
+	/* Reinitialize, if the mode changes. */
+	int (*reinit)(struct device_poll *device_poll);
+
+	/* Lock and unlock, for consistency when changing settings. */
+	void (*lock)(struct device_poll *device_poll);
+	void (*unlock)(struct device_poll *device_poll);
+
+	/* Polled interrupt handler. */
+	void (*interrupt)(struct device_poll *device_poll);
+};
+
+struct device_poll {
+	/* The following must be initialized by the driver before calling
+	   device_poll_init. */
+
+	/* The device for which we're polling. */
+	struct device *device;
+
+	/* Device operations. */
+	struct device_poll_ops *ops;
+
+	/* A capability can be specified to allow non-root users to modify
+	   the sysfs attributes. */
+	bool use_capability;
+	int capability;
+
+	/* Polling interval in milliseconds. A value of 0 or less means
+	   use interrupts. */
+	int interval;
+
+	/* Polling task policy and priority, such as SCHED_FIFO 10. */
+	int policy;
+	int priority;
+
+	/* The following are internal struct members and should not be touched
+	   by drivers. */
+
+	struct task_struct *task;
+	int enabled;
+
+	struct dev_ext_attribute interval_attr;
+	struct dev_ext_attribute policy_attr;
+	struct dev_ext_attribute priority_attr;
+	struct attribute *attrs[4];
+	struct attribute_group attr_group;
+};
+
+int device_poll_init(struct device_poll *device_poll);
+void device_poll_exit(struct device_poll *device_poll);
+
+int device_poll_request_irq(struct device_poll *device_poll);
+void device_poll_free_irq(struct device_poll *device_poll);
+
+static inline int device_poll_is_active(struct device_poll *device_poll)
+{
+	return likely(device_poll) && (device_poll->task != NULL);
+}
+
+static inline void device_poll_enable_irq(struct device_poll *device_poll)
+{
+	if (device_poll_is_active(device_poll)) {
+		device_poll->enabled = 1;
+		/* Ensure changes to device_poll->enabled are seen by the
+		   polling thread. */
+		smp_wmb();
+	}
+}
+
+static inline void device_poll_disable_irq(struct device_poll *device_poll)
+{
+	if (device_poll_is_active(device_poll)) {
+		device_poll->enabled = 0;
+		/* Ensure changes to device_poll->enabled are seen by the
+		   polling thread. */
+		smp_wmb();
+	}
+}
+
+#endif
+
+#endif /* _LINUX_DEVICE_POLL_H_ */
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH net-next] cxgb4: Fixes cxgb4_inet6addr_notifier unregister call
From: David Miller @ 2015-01-26 22:46 UTC (permalink / raw)
  To: hariprasad; +Cc: netdev, leedom, anish, nirranjan, praveenm
In-Reply-To: <1421854072-6427-1-git-send-email-hariprasad@chelsio.com>

From: Hariprasad Shenai <hariprasad@chelsio.com>
Date: Wed, 21 Jan 2015 20:57:52 +0530

> commit b5a02f503caa0837 ("cxgb4 : Update ipv6 address handling api") introduced
> a regression where unregister cxgb4_inet6addr_notifier wasn't getting called
> during module_exit.
> 
> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>

Applied, thanks.

^ permalink raw reply

* Re: [PATCH net-next] sunvnet: improve error handling when a remote crashes
From: Sowmini Varadhan @ 2015-01-26 22:45 UTC (permalink / raw)
  To: David L Stevens; +Cc: David Miller, netdev
In-Reply-To: <54C6A95F.8010602@oracle.com>

On (01/26/15 15:53), David L Stevens wrote:
> 
> I demoted it to a notice and we can change it to a counter when we add
> stats. This way it's clear that it's an unexpected state and it's easy
> to see them when we want them.

fair enough.

--Sowmini

^ permalink raw reply

* Re: [PATCH 0/2 net-next] sunvnet: fix null pointer deref and crash recovery
From: Sowmini Varadhan @ 2015-01-26 22:44 UTC (permalink / raw)
  To: David L Stevens; +Cc: David Miller, netdev
In-Reply-To: <54C6A976.4060502@oracle.com>

On (01/26/15 15:54), David L Stevens wrote:
> These patches fix an incorrect ordering in releasing ring data, clear pending
> tx buffers on a reset, and make the sunvnet driver more reliable when remote
> systems crash during active transmits.

Acked-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>

^ permalink raw reply

* Re: [PATCH 1/2] rhashtable: Introduce rhashtable_walk_*
From: Herbert Xu @ 2015-01-26 22:42 UTC (permalink / raw)
  To: David Miller
  Cc: David.Laight, tgraf, ying.xue, kaber, paulmck, netdev,
	netfilter-devel
In-Reply-To: <20150126.143613.1798698028405169123.davem@davemloft.net>

On Mon, Jan 26, 2015 at 02:36:13PM -0800, David Miller wrote:
>
> I really think the amount of time and effort being put into making
> the walker function properly is excessive.
> 
> Let's just say that if you want to use rhashtable, you have to use a
> linked list, or similar separate mechanism, to have stable walks of
> the entire set of objects.

I definitely agree with that :)

However, I'd really like to get these primitives in first so that
at least I can convert the existing rhashtable walkers over and
get on with implementing rhashtable rehashing which is what I set
out to do.

As otherwise we'd be looking at fixing the existing users (in
particular, nft_hash) properly which might take a lot more time.

If and when we finally fix the existing users we can always remove
these primitives.

FWIW when I first wrote this patch I called it
rhashtable_walk_dangerously, I can readopt that name if you think
that will dissuade people from using it.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply


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