* Re: [PATCH net-next] net: dsa: kill circular reference with slave priv
From: David Miller @ 2016-04-20 0:29 UTC (permalink / raw)
To: vivien.didelot; +Cc: netdev, linux-kernel, kernel, f.fainelli, andrew
In-Reply-To: <1461010224-10808-1-git-send-email-vivien.didelot@savoirfairelinux.com>
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Mon, 18 Apr 2016 16:10:24 -0400
> The dsa_slave_priv structure does not need a pointer to its net_device.
> Kill it.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 0/7] net: network drivers should not depend on geneve/vxlan
From: David Miller @ 2016-04-20 0:27 UTC (permalink / raw)
To: hannes; +Cc: netdev, jesse
In-Reply-To: <1461007188-1603-1-git-send-email-hannes@stressinduktion.org>
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Mon, 18 Apr 2016 21:19:41 +0200
> This patchset removes the dependency of network drivers on vxlan or
> geneve, so those don't get autoloaded when the nic driver is loaded.
>
> Also audited the code such that vxlan_get_rx_port and geneve_get_rx_port
> are not called without rtnl lock.
In net-next, the 'qed' driver has tunneling offload support too.
Don't you need to update this series to handle that driver as
well?
Thanks.
^ permalink raw reply
* Re: [PATCH net-next v2 0/2] BPF updates
From: David Miller @ 2016-04-20 0:26 UTC (permalink / raw)
To: daniel; +Cc: alexei.starovoitov, tgraf, netdev, linux-kernel
In-Reply-To: <cover.1461005139.git.daniel@iogearbox.net>
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Mon, 18 Apr 2016 21:01:22 +0200
> This minor set adds a new helper bpf_event_output() for eBPF cls/act
> program types which allows to pass events to user space applications.
> For details, please see individual patches.
...
> v1 -> v2:
> - Address kbuild bot found compile issue in patch 2
> - Rest as is
>
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 0/3] qede: Bug fixes
From: David Miller @ 2016-04-20 0:21 UTC (permalink / raw)
To: manish.chopra; +Cc: netdev, Ariel.Elior, Yuval.Mintz
In-Reply-To: <1460999167-3746-1-git-send-email-manish.chopra@qlogic.com>
From: Manish Chopra <manish.chopra@qlogic.com>
Date: Mon, 18 Apr 2016 13:06:04 -0400
> Please note that I have intentionally targeted this for "net-next"
> to avoid merge conflicts when net-next changes gets merged to net
>
> Please consider applying this series to "net-next"
I do not understand what you are saying here.
If these bugs exist in 'net' you must target these bug fixes
there.
If there will be merge conflicts after this when I merge net
into net-next, that's exactly what is supposed to happen and
is what I'm supposed to work on to resolve. That's my job.
^ permalink raw reply
* Re: [PATCH 2/5] arcnet: com90xx: add __init attribute
From: David Miller @ 2016-04-20 0:18 UTC (permalink / raw)
To: Julia.Lawall
Cc: m.grzeschik, kernel-janitors, netdev, linux-kernel, mcgrof, josh
In-Reply-To: <1460991338-9845-3-git-send-email-Julia.Lawall@lip6.fr>
From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Mon, 18 Apr 2016 16:55:35 +0200
> Add __init attribute on a function that is only called from other __init
> functions and that is not inlined, at least with gcc version 4.8.4 on an
> x86 machine with allyesconfig. Currently, the function is put in the
> .text.unlikely segment. Declaring it as __init will cause it to be put in
> the .init.text and to disappear after initialization.
>
> The result of objdump -x on the function before the change is as follows:
>
> 0000000000000000 l F .text.unlikely 00000000000000bf check_mirror
>
> And after the change it is as follows:
>
> 0000000000000000 l F .init.text 00000000000000ba check_mirror
>
> Done with the help of Coccinelle. The semantic patch checks for local
> static non-init functions that are called from an __init function and are
> not called from any other function.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH v2 0/1] drivers: net: cpsw: Fix NULL pointer dereference with two slave PHYs
From: David Miller @ 2016-04-20 0:15 UTC (permalink / raw)
To: andrew.goodbody; +Cc: netdev, linux-kernel
In-Reply-To: <1460987606-18125-1-git-send-email-andrew.goodbody@cambrionix.com>
From: Andrew Goodbody <andrew.goodbody@cambrionix.com>
Date: Mon, 18 Apr 2016 14:53:25 +0100
> This is a fix for a NULL pointer dereference from cpsw which is triggered
> by having two slave PHYs attached to a cpsw network device. The problem is
> due to only maintaining a single reference to a PHY node in the prive data
> which gets overwritten by the second PHY probe. So move the PHY node
> reference to the individual slave data so that there is now one per slave.
>
> v1 had a problem that data->slaves was used before it had been filled in
I already applied v1 the other day, so you need to send me a relative
patch rather than a whole new one.
Thanks.
^ permalink raw reply
* Re: [PATCH 2/2] net/ipv6/addrconf: fix sysctl table indentation
From: David Miller @ 2016-04-20 0:13 UTC (permalink / raw)
To: khlebnikov; +Cc: netdev, linux-kernel
In-Reply-To: <146097967761.15409.8428180075560908884.stgit@buzz>
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date: Mon, 18 Apr 2016 14:41:17 +0300
> Separated from previous patch for readability.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Applied.
^ permalink raw reply
* Re: [PATCH 1/2] net/ipv6/addrconf: simplify sysctl registration
From: David Miller @ 2016-04-20 0:13 UTC (permalink / raw)
To: khlebnikov; +Cc: netdev, linux-kernel
In-Reply-To: <146097967035.15409.8235893232862124602.stgit@buzz>
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date: Mon, 18 Apr 2016 14:41:10 +0300
> Struct ctl_table_header holds pointer to sysctl table which could be used
> for freeing it after unregistration. IPv4 sysctls already use that.
> Remove redundant NULL assignment: ndev allocated using kzalloc.
>
> This also saves some bytes: sysctl table could be shorter than
> DEVCONF_MAX+1 if some options are disable in config.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Applied.
^ permalink raw reply
* Re: [PATCH] cls_cgroup: get sk_classid only from full sockets
From: David Miller @ 2016-04-20 0:09 UTC (permalink / raw)
To: khlebnikov-XoJtRXgx1JseBXzfvpsJ4g
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <146097943086.15300.8997345346172526153.stgit@buzz>
From: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
Date: Mon, 18 Apr 2016 14:37:10 +0300
> skb->sk could point to timewait or request socket which has no sk_classid.
> Detected as "BUG: KASAN: slab-out-of-bounds in cls_cgroup_classify".
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov-XoJtRXgx1JseBXzfvpsJ4g@public.gmane.org>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH] net/mlx4_en: do batched put_page using atomic_sub
From: David Miller @ 2016-04-20 0:07 UTC (permalink / raw)
To: khlebnikov; +Cc: netdev, yishaih, eugenia, linux-kernel
In-Reply-To: <146097924572.15144.10837875571142670008.stgit@buzz>
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date: Mon, 18 Apr 2016 14:34:05 +0300
> This patch fixes couple error paths after allocation failures.
> Atomic set of page reference counter is safe only if it is zero,
> otherwise set can race with any speculative get_page_unless_zero.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Applied.
^ permalink raw reply
* Re: [PATCH] net/mlx4_en: allocate non 0-order pages for RX ring with __GFP_NOMEMALLOC
From: David Miller @ 2016-04-20 0:07 UTC (permalink / raw)
To: khlebnikov; +Cc: netdev, yishaih, eugenia, linux-kernel
In-Reply-To: <146097923460.15114.8965134124148581055.stgit@buzz>
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date: Mon, 18 Apr 2016 14:33:54 +0300
> High order pages are optional here since commit 51151a16a60f ("mlx4: allow
> order-0 memory allocations in RX path"), so here is no reason for depleting
> reserves. Generic __netdev_alloc_frag() implements the same logic.
>
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Applied.
^ permalink raw reply
* [PATCH V2] net: stmmac: socfpga: Remove re-registration of reset controller
From: Marek Vasut @ 2016-04-20 0:05 UTC (permalink / raw)
To: netdev
Cc: peppe.cavallaro, alexandre.torgue, Marek Vasut, Matthew Gerlach,
Dinh Nguyen, David S . Miller
Both socfpga_dwmac_parse_data() in dwmac-socfpga.c and stmmac_dvr_probe()
in stmmac_main.c functions call devm_reset_control_get() to register an
reset controller for the stmmac. This results in an attempt to register
two reset controllers for the same non-shared reset line.
The first attempt to register the reset controller works fine. The second
attempt fails with warning from the reset controller core, see below.
The warning is produced because the reset line is non-shared and thus
it is allowed to have only up-to one reset controller associated with
that reset line, not two or more.
The solution is not great. Since the hardware needs to toggle the reset
before calling stmmac_dvr_probe() to perform mandatory preconfiguration,
this patch splits socfpga_dwmac_init_probe() from socfpga_dwmac_init().
The socfpga_dwmac_init_probe() temporarily registers the reset controller,
performs the pre-configuration and unregisters the reset controller again.
This function is only called from the socfpga_dwmac_probe().
The original socfpga_dwmac_init() is tweaked to use reset controller
pointer from the stmmac_priv (private data of the stmmac core) instead
of the local instance, which was used before.
Finally, plat_dat->exit and socfpga_dwmac_exit() is no longer necessary,
since the functionality is already performed by the stmmac core.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at drivers/reset/core.c:187 __of_reset_control_get+0x218/0x270
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc4-next-20160419-00015-gabb2477-dirty #4
Hardware name: Altera SOCFPGA
[<c010f290>] (unwind_backtrace) from [<c010b82c>] (show_stack+0x10/0x14)
[<c010b82c>] (show_stack) from [<c0373da4>] (dump_stack+0x94/0xa8)
[<c0373da4>] (dump_stack) from [<c011bcc0>] (__warn+0xec/0x104)
[<c011bcc0>] (__warn) from [<c011bd88>] (warn_slowpath_null+0x20/0x28)
[<c011bd88>] (warn_slowpath_null) from [<c03a6eb4>] (__of_reset_control_get+0x218/0x270)
[<c03a6eb4>] (__of_reset_control_get) from [<c03a701c>] (__devm_reset_control_get+0x54/0x90)
[<c03a701c>] (__devm_reset_control_get) from [<c041fa30>] (stmmac_dvr_probe+0x1b4/0x8e8)
[<c041fa30>] (stmmac_dvr_probe) from [<c04298c8>] (socfpga_dwmac_probe+0x1b8/0x28c)
[<c04298c8>] (socfpga_dwmac_probe) from [<c03d6ffc>] (platform_drv_probe+0x4c/0xb0)
[<c03d6ffc>] (platform_drv_probe) from [<c03d54ec>] (driver_probe_device+0x224/0x2bc)
[<c03d54ec>] (driver_probe_device) from [<c03d5630>] (__driver_attach+0xac/0xb0)
[<c03d5630>] (__driver_attach) from [<c03d382c>] (bus_for_each_dev+0x6c/0xa0)
[<c03d382c>] (bus_for_each_dev) from [<c03d4ad4>] (bus_add_driver+0x1a4/0x21c)
[<c03d4ad4>] (bus_add_driver) from [<c03d60ac>] (driver_register+0x78/0xf8)
[<c03d60ac>] (driver_register) from [<c0101760>] (do_one_initcall+0x40/0x170)
[<c0101760>] (do_one_initcall) from [<c0800e38>] (kernel_init_freeable+0x1dc/0x27c)
[<c0800e38>] (kernel_init_freeable) from [<c05d1bd4>] (kernel_init+0x8/0x114)
[<c05d1bd4>] (kernel_init) from [<c01076f8>] (ret_from_fork+0x14/0x3c)
---[ end trace 059d2fbe87608fa9 ]---
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Matthew Gerlach <mgerlach@opensource.altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: David S. Miller <davem@davemloft.net>
---
V2: Add missing stmmac_rst = NULL; into socfpga_dwmac_init_probe()
---
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 70 ++++++++++++----------
1 file changed, 39 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 76d671e..5885a2e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -49,7 +49,6 @@ struct socfpga_dwmac {
u32 reg_shift;
struct device *dev;
struct regmap *sys_mgr_base_addr;
- struct reset_control *stmmac_rst;
void __iomem *splitter_base;
bool f2h_ptp_ref_clk;
};
@@ -92,15 +91,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
struct device_node *np_splitter;
struct resource res_splitter;
- dwmac->stmmac_rst = devm_reset_control_get(dev,
- STMMAC_RESOURCE_NAME);
- if (IS_ERR(dwmac->stmmac_rst)) {
- dev_info(dev, "Could not get reset control!\n");
- if (PTR_ERR(dwmac->stmmac_rst) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dwmac->stmmac_rst = NULL;
- }
-
dwmac->interface = of_get_phy_mode(np);
sys_mgr_base_addr = syscon_regmap_lookup_by_phandle(np, "altr,sysmgr-syscon");
@@ -194,30 +184,23 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
return 0;
}
-static void socfpga_dwmac_exit(struct platform_device *pdev, void *priv)
-{
- struct socfpga_dwmac *dwmac = priv;
-
- /* On socfpga platform exit, assert and hold reset to the
- * enet controller - the default state after a hard reset.
- */
- if (dwmac->stmmac_rst)
- reset_control_assert(dwmac->stmmac_rst);
-}
-
static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
{
- struct socfpga_dwmac *dwmac = priv;
+ struct socfpga_dwmac *dwmac = priv;
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *stpriv = NULL;
int ret = 0;
- if (ndev)
- stpriv = netdev_priv(ndev);
+ if (!ndev)
+ return -EINVAL;
+
+ stpriv = netdev_priv(ndev);
+ if (!stpriv)
+ return -EINVAL;
/* Assert reset to the enet controller before changing the phy mode */
- if (dwmac->stmmac_rst)
- reset_control_assert(dwmac->stmmac_rst);
+ if (stpriv->stmmac_rst)
+ reset_control_assert(stpriv->stmmac_rst);
/* Setup the phy mode in the system manager registers according to
* devicetree configuration
@@ -227,8 +210,8 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
/* Deassert reset for the phy configuration to be sampled by
* the enet controller, and operation to start in requested mode
*/
- if (dwmac->stmmac_rst)
- reset_control_deassert(dwmac->stmmac_rst);
+ if (stpriv->stmmac_rst)
+ reset_control_deassert(stpriv->stmmac_rst);
/* Before the enet controller is suspended, the phy is suspended.
* This causes the phy clock to be gated. The enet controller is
@@ -245,12 +228,38 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
* control register 0, and can be modified by the phy driver
* framework.
*/
- if (stpriv && stpriv->phydev)
+ if (stpriv->phydev)
phy_resume(stpriv->phydev);
return ret;
}
+static int socfpga_dwmac_init_probe(struct socfpga_dwmac *dwmac)
+{
+ struct reset_control *stmmac_rst;
+ int ret;
+
+ stmmac_rst = reset_control_get(dwmac->dev, STMMAC_RESOURCE_NAME);
+ if (IS_ERR(stmmac_rst)) {
+ dev_info(dwmac->dev, "Could not get reset control!\n");
+ if (PTR_ERR(stmmac_rst) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ stmmac_rst = NULL;
+ }
+
+ if (stmmac_rst)
+ reset_control_assert(stmmac_rst);
+
+ ret = socfpga_dwmac_setup(dwmac);
+
+ if (stmmac_rst) {
+ reset_control_deassert(stmmac_rst);
+ reset_control_put(stmmac_rst);
+ }
+
+ return ret;
+}
+
static int socfpga_dwmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
@@ -279,10 +288,9 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
plat_dat->bsp_priv = dwmac;
plat_dat->init = socfpga_dwmac_init;
- plat_dat->exit = socfpga_dwmac_exit;
plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
- ret = socfpga_dwmac_init(pdev, plat_dat->bsp_priv);
+ ret = socfpga_dwmac_init_probe(dwmac);
if (ret)
return ret;
--
2.7.0
^ permalink raw reply related
* Re: [PATCH] net: stmmac: socfpga: Remove re-registration of reset controller
From: Marek Vasut @ 2016-04-20 0:02 UTC (permalink / raw)
To: netdev
Cc: peppe.cavallaro, alexandre.torgue, Matthew Gerlach, Dinh Nguyen,
David S . Miller
In-Reply-To: <1461109740-7105-1-git-send-email-marex@denx.de>
On 04/20/2016 01:49 AM, Marek Vasut wrote:
> Both socfpga_dwmac_parse_data() in dwmac-socfpga.c and stmmac_dvr_probe()
> in stmmac_main.c functions call devm_reset_control_get() to register an
> reset controller for the stmmac. This results in an attempt to register
> two reset controllers for the same non-shared reset line.
>
> The first attempt to register the reset controller works fine. The second
> attempt fails with warning from the reset controller core, see below.
> The warning is produced because the reset line is non-shared and thus
> it is allowed to have only up-to one reset controller associated with
> that reset line, not two or more.
>
> The solution is not great. Since the hardware needs to toggle the reset
> before calling stmmac_dvr_probe() to perform mandatory preconfiguration,
> this patch splits socfpga_dwmac_init_probe() from socfpga_dwmac_init().
>
> The socfpga_dwmac_init_probe() temporarily registers the reset controller,
> performs the pre-configuration and unregisters the reset controller again.
> This function is only called from the socfpga_dwmac_probe().
>
> The original socfpga_dwmac_init() is tweaked to use reset controller
> pointer from the stmmac_priv (private data of the stmmac core) instead
> of the local instance, which was used before.
>
> Finally, plat_dat->exit and socfpga_dwmac_exit() is no longer necessary,
> since the functionality is already performed by the stmmac core.
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at drivers/reset/core.c:187 __of_reset_control_get+0x218/0x270
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc4-next-20160419-00015-gabb2477-dirty #4
> Hardware name: Altera SOCFPGA
> [<c010f290>] (unwind_backtrace) from [<c010b82c>] (show_stack+0x10/0x14)
> [<c010b82c>] (show_stack) from [<c0373da4>] (dump_stack+0x94/0xa8)
> [<c0373da4>] (dump_stack) from [<c011bcc0>] (__warn+0xec/0x104)
> [<c011bcc0>] (__warn) from [<c011bd88>] (warn_slowpath_null+0x20/0x28)
> [<c011bd88>] (warn_slowpath_null) from [<c03a6eb4>] (__of_reset_control_get+0x218/0x270)
> [<c03a6eb4>] (__of_reset_control_get) from [<c03a701c>] (__devm_reset_control_get+0x54/0x90)
> [<c03a701c>] (__devm_reset_control_get) from [<c041fa30>] (stmmac_dvr_probe+0x1b4/0x8e8)
> [<c041fa30>] (stmmac_dvr_probe) from [<c04298c8>] (socfpga_dwmac_probe+0x1b8/0x28c)
> [<c04298c8>] (socfpga_dwmac_probe) from [<c03d6ffc>] (platform_drv_probe+0x4c/0xb0)
> [<c03d6ffc>] (platform_drv_probe) from [<c03d54ec>] (driver_probe_device+0x224/0x2bc)
> [<c03d54ec>] (driver_probe_device) from [<c03d5630>] (__driver_attach+0xac/0xb0)
> [<c03d5630>] (__driver_attach) from [<c03d382c>] (bus_for_each_dev+0x6c/0xa0)
> [<c03d382c>] (bus_for_each_dev) from [<c03d4ad4>] (bus_add_driver+0x1a4/0x21c)
> [<c03d4ad4>] (bus_add_driver) from [<c03d60ac>] (driver_register+0x78/0xf8)
> [<c03d60ac>] (driver_register) from [<c0101760>] (do_one_initcall+0x40/0x170)
> [<c0101760>] (do_one_initcall) from [<c0800e38>] (kernel_init_freeable+0x1dc/0x27c)
> [<c0800e38>] (kernel_init_freeable) from [<c05d1bd4>] (kernel_init+0x8/0x114)
> [<c05d1bd4>] (kernel_init) from [<c01076f8>] (ret_from_fork+0x14/0x3c)
> ---[ end trace 059d2fbe87608fa9 ]---
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Matthew Gerlach <mgerlach@opensource.altera.com>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
> .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 69 ++++++++++++----------
> 1 file changed, 38 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index 76d671e..9ece2dd 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -49,7 +49,6 @@ struct socfpga_dwmac {
> u32 reg_shift;
> struct device *dev;
> struct regmap *sys_mgr_base_addr;
> - struct reset_control *stmmac_rst;
> void __iomem *splitter_base;
> bool f2h_ptp_ref_clk;
> };
> @@ -92,15 +91,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
> struct device_node *np_splitter;
> struct resource res_splitter;
>
> - dwmac->stmmac_rst = devm_reset_control_get(dev,
> - STMMAC_RESOURCE_NAME);
> - if (IS_ERR(dwmac->stmmac_rst)) {
> - dev_info(dev, "Could not get reset control!\n");
> - if (PTR_ERR(dwmac->stmmac_rst) == -EPROBE_DEFER)
> - return -EPROBE_DEFER;
> - dwmac->stmmac_rst = NULL;
> - }
> -
> dwmac->interface = of_get_phy_mode(np);
>
> sys_mgr_base_addr = syscon_regmap_lookup_by_phandle(np, "altr,sysmgr-syscon");
> @@ -194,30 +184,23 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
> return 0;
> }
>
> -static void socfpga_dwmac_exit(struct platform_device *pdev, void *priv)
> -{
> - struct socfpga_dwmac *dwmac = priv;
> -
> - /* On socfpga platform exit, assert and hold reset to the
> - * enet controller - the default state after a hard reset.
> - */
> - if (dwmac->stmmac_rst)
> - reset_control_assert(dwmac->stmmac_rst);
> -}
> -
> static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
> {
> - struct socfpga_dwmac *dwmac = priv;
> + struct socfpga_dwmac *dwmac = priv;
> struct net_device *ndev = platform_get_drvdata(pdev);
> struct stmmac_priv *stpriv = NULL;
> int ret = 0;
>
> - if (ndev)
> - stpriv = netdev_priv(ndev);
> + if (!ndev)
> + return -EINVAL;
> +
> + stpriv = netdev_priv(ndev);
> + if (!stpriv)
> + return -EINVAL;
>
> /* Assert reset to the enet controller before changing the phy mode */
> - if (dwmac->stmmac_rst)
> - reset_control_assert(dwmac->stmmac_rst);
> + if (stpriv->stmmac_rst)
> + reset_control_assert(stpriv->stmmac_rst);
>
> /* Setup the phy mode in the system manager registers according to
> * devicetree configuration
> @@ -227,8 +210,8 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
> /* Deassert reset for the phy configuration to be sampled by
> * the enet controller, and operation to start in requested mode
> */
> - if (dwmac->stmmac_rst)
> - reset_control_deassert(dwmac->stmmac_rst);
> + if (stpriv->stmmac_rst)
> + reset_control_deassert(stpriv->stmmac_rst);
>
> /* Before the enet controller is suspended, the phy is suspended.
> * This causes the phy clock to be gated. The enet controller is
> @@ -245,12 +228,37 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
> * control register 0, and can be modified by the phy driver
> * framework.
> */
> - if (stpriv && stpriv->phydev)
> + if (stpriv->phydev)
> phy_resume(stpriv->phydev);
>
> return ret;
> }
>
> +static int socfpga_dwmac_init_probe(struct socfpga_dwmac *dwmac)
> +{
> + struct reset_control *stmmac_rst;
> + int ret;
> +
> + stmmac_rst = reset_control_get(dwmac->dev, STMMAC_RESOURCE_NAME);
> + if (IS_ERR(stmmac_rst)) {
> + dev_info(dwmac->dev, "Could not get reset control!\n");
> + if (PTR_ERR(stmmac_rst) == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
There should be stmmac_rst = NULL; here, so the checks below work
correctly. Will be added in V2 if the idea of this patch makes sense.
> + }
> +
> + if (stmmac_rst)
> + reset_control_assert(stmmac_rst);
> +
> + ret = socfpga_dwmac_setup(dwmac);
> +
> + if (stmmac_rst) {
> + reset_control_deassert(stmmac_rst);
> + reset_control_put(stmmac_rst);
> + }
> +
> + return ret;
> +}
> +
> static int socfpga_dwmac_probe(struct platform_device *pdev)
> {
> struct plat_stmmacenet_data *plat_dat;
> @@ -279,10 +287,9 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
>
> plat_dat->bsp_priv = dwmac;
> plat_dat->init = socfpga_dwmac_init;
> - plat_dat->exit = socfpga_dwmac_exit;
> plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
>
> - ret = socfpga_dwmac_init(pdev, plat_dat->bsp_priv);
> + ret = socfpga_dwmac_init_probe(dwmac);
> if (ret)
> return ret;
>
>
--
Best regards,
Marek Vasut
^ permalink raw reply
* Re: [PATCH net-next 1/3] ila: Add struct definitions and helpers
From: David Miller @ 2016-04-20 0:00 UTC (permalink / raw)
To: tom; +Cc: netdev, kernel-team
In-Reply-To: <1460752452-3328784-2-git-send-email-tom@herbertland.com>
From: Tom Herbert <tom@herbertland.com>
Date: Fri, 15 Apr 2016 13:34:10 -0700
> + if (!ila_is_ila_addr(iaddr)) {
This doesn't compile.
^ permalink raw reply
* Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats
From: David Miller @ 2016-04-19 23:50 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: eric.dumazet, roopa, netdev, jhs, tgraf
In-Reply-To: <57168225.2040507@6wind.com>
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 19 Apr 2016 21:08:21 +0200
> Le 19/04/2016 20:47, Eric Dumazet a écrit :
>> Since we want to use this in other places, we could define a helper.
>>
>> nla_align_64bit(skb, attribute) or something.
> Yes, with the corresponding nla_total_size_64bit()
Good, idea, committed the following:
Roopa, please use these helpers in your RTM_GETSTATS patch.
Thank you.
====================
[PATCH] net: Add helpers for 64-bit aligning netlink attributes.
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Suggested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
include/net/netlink.h | 37 +++++++++++++++++++++++++++++++++++++
net/core/rtnetlink.c | 24 +++++-------------------
2 files changed, 42 insertions(+), 19 deletions(-)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 0e31727..e644b34 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -1231,6 +1231,43 @@ static inline int nla_validate_nested(const struct nlattr *start, int maxtype,
}
/**
+ * nla_align_64bit - 64-bit align the nla_data() of next attribute
+ * @skb: socket buffer the message is stored in
+ * @padattr: attribute type for the padding
+ *
+ * Conditionally emit a padding netlink attribute in order to make
+ * the next attribute we emit have a 64-bit aligned nla_data() area.
+ * This will only be done in architectures which do not have
+ * HAVE_EFFICIENT_UNALIGNED_ACCESS defined.
+ *
+ * Returns zero on success or a negative error code.
+ */
+static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
+{
+#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
+ if (IS_ALIGNED((unsigned long)skb->data, 8)) {
+ struct nlattr *attr = nla_reserve(skb, padattr, 0);
+ if (!attr)
+ return -EMSGSIZE;
+ }
+#endif
+ return 0;
+}
+
+/**
+ * nla_total_size_64bit - total length of attribute including padding
+ * @payload: length of payload
+ */
+static inline int nla_total_size_64bit(int payload)
+{
+ return NLA_ALIGN(nla_attr_size(payload))
+#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
+ + NLA_ALIGN(nla_attr_size(0))
+#endif
+ ;
+}
+
+/**
* nla_for_each_attr - iterate over a stream of attributes
* @pos: loop counter, set to current attribute
* @head: head of attribute stream
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 198ca2c..d3694a1 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -878,10 +878,7 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev,
+ nla_total_size(IFNAMSIZ) /* IFLA_QDISC */
+ nla_total_size(sizeof(struct rtnl_link_ifmap))
+ nla_total_size(sizeof(struct rtnl_link_stats))
-#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
- + nla_total_size(0) /* IFLA_PAD */
-#endif
- + nla_total_size(sizeof(struct rtnl_link_stats64))
+ + nla_total_size_64bit(sizeof(struct rtnl_link_stats64))
+ nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */
+ nla_total_size(MAX_ADDR_LEN) /* IFLA_BROADCAST */
+ nla_total_size(4) /* IFLA_TXQLEN */
@@ -1054,22 +1051,11 @@ static noinline_for_stack int rtnl_fill_stats(struct sk_buff *skb,
{
struct rtnl_link_stats64 *sp;
struct nlattr *attr;
+ int err;
-#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS
- /* IF necessary, add a zero length NOP attribute so that the
- * nla_data() of the IFLA_STATS64 will be 64-bit aligned.
- *
- * The nlattr header is 4 bytes in size, that's why we test
- * if the skb->data _is_ aligned. This NOP attribute, plus
- * nlattr header for IFLA_STATS64, will make nla_data() 8-byte
- * aligned.
- */
- if (IS_ALIGNED((unsigned long)skb->data, 8)) {
- attr = nla_reserve(skb, IFLA_PAD, 0);
- if (!attr)
- return -EMSGSIZE;
- }
-#endif
+ err = nla_align_64bit(skb, IFLA_PAD);
+ if (err)
+ return err;
attr = nla_reserve(skb, IFLA_STATS64,
sizeof(struct rtnl_link_stats64));
--
2.1.0
^ permalink raw reply related
* [PATCH] net: stmmac: socfpga: Remove re-registration of reset controller
From: Marek Vasut @ 2016-04-19 23:49 UTC (permalink / raw)
To: netdev
Cc: peppe.cavallaro, alexandre.torgue, Marek Vasut, Matthew Gerlach,
Dinh Nguyen, David S . Miller
Both socfpga_dwmac_parse_data() in dwmac-socfpga.c and stmmac_dvr_probe()
in stmmac_main.c functions call devm_reset_control_get() to register an
reset controller for the stmmac. This results in an attempt to register
two reset controllers for the same non-shared reset line.
The first attempt to register the reset controller works fine. The second
attempt fails with warning from the reset controller core, see below.
The warning is produced because the reset line is non-shared and thus
it is allowed to have only up-to one reset controller associated with
that reset line, not two or more.
The solution is not great. Since the hardware needs to toggle the reset
before calling stmmac_dvr_probe() to perform mandatory preconfiguration,
this patch splits socfpga_dwmac_init_probe() from socfpga_dwmac_init().
The socfpga_dwmac_init_probe() temporarily registers the reset controller,
performs the pre-configuration and unregisters the reset controller again.
This function is only called from the socfpga_dwmac_probe().
The original socfpga_dwmac_init() is tweaked to use reset controller
pointer from the stmmac_priv (private data of the stmmac core) instead
of the local instance, which was used before.
Finally, plat_dat->exit and socfpga_dwmac_exit() is no longer necessary,
since the functionality is already performed by the stmmac core.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at drivers/reset/core.c:187 __of_reset_control_get+0x218/0x270
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc4-next-20160419-00015-gabb2477-dirty #4
Hardware name: Altera SOCFPGA
[<c010f290>] (unwind_backtrace) from [<c010b82c>] (show_stack+0x10/0x14)
[<c010b82c>] (show_stack) from [<c0373da4>] (dump_stack+0x94/0xa8)
[<c0373da4>] (dump_stack) from [<c011bcc0>] (__warn+0xec/0x104)
[<c011bcc0>] (__warn) from [<c011bd88>] (warn_slowpath_null+0x20/0x28)
[<c011bd88>] (warn_slowpath_null) from [<c03a6eb4>] (__of_reset_control_get+0x218/0x270)
[<c03a6eb4>] (__of_reset_control_get) from [<c03a701c>] (__devm_reset_control_get+0x54/0x90)
[<c03a701c>] (__devm_reset_control_get) from [<c041fa30>] (stmmac_dvr_probe+0x1b4/0x8e8)
[<c041fa30>] (stmmac_dvr_probe) from [<c04298c8>] (socfpga_dwmac_probe+0x1b8/0x28c)
[<c04298c8>] (socfpga_dwmac_probe) from [<c03d6ffc>] (platform_drv_probe+0x4c/0xb0)
[<c03d6ffc>] (platform_drv_probe) from [<c03d54ec>] (driver_probe_device+0x224/0x2bc)
[<c03d54ec>] (driver_probe_device) from [<c03d5630>] (__driver_attach+0xac/0xb0)
[<c03d5630>] (__driver_attach) from [<c03d382c>] (bus_for_each_dev+0x6c/0xa0)
[<c03d382c>] (bus_for_each_dev) from [<c03d4ad4>] (bus_add_driver+0x1a4/0x21c)
[<c03d4ad4>] (bus_add_driver) from [<c03d60ac>] (driver_register+0x78/0xf8)
[<c03d60ac>] (driver_register) from [<c0101760>] (do_one_initcall+0x40/0x170)
[<c0101760>] (do_one_initcall) from [<c0800e38>] (kernel_init_freeable+0x1dc/0x27c)
[<c0800e38>] (kernel_init_freeable) from [<c05d1bd4>] (kernel_init+0x8/0x114)
[<c05d1bd4>] (kernel_init) from [<c01076f8>] (ret_from_fork+0x14/0x3c)
---[ end trace 059d2fbe87608fa9 ]---
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Matthew Gerlach <mgerlach@opensource.altera.com>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: David S. Miller <davem@davemloft.net>
---
.../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 69 ++++++++++++----------
1 file changed, 38 insertions(+), 31 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
index 76d671e..9ece2dd 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
@@ -49,7 +49,6 @@ struct socfpga_dwmac {
u32 reg_shift;
struct device *dev;
struct regmap *sys_mgr_base_addr;
- struct reset_control *stmmac_rst;
void __iomem *splitter_base;
bool f2h_ptp_ref_clk;
};
@@ -92,15 +91,6 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
struct device_node *np_splitter;
struct resource res_splitter;
- dwmac->stmmac_rst = devm_reset_control_get(dev,
- STMMAC_RESOURCE_NAME);
- if (IS_ERR(dwmac->stmmac_rst)) {
- dev_info(dev, "Could not get reset control!\n");
- if (PTR_ERR(dwmac->stmmac_rst) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
- dwmac->stmmac_rst = NULL;
- }
-
dwmac->interface = of_get_phy_mode(np);
sys_mgr_base_addr = syscon_regmap_lookup_by_phandle(np, "altr,sysmgr-syscon");
@@ -194,30 +184,23 @@ static int socfpga_dwmac_setup(struct socfpga_dwmac *dwmac)
return 0;
}
-static void socfpga_dwmac_exit(struct platform_device *pdev, void *priv)
-{
- struct socfpga_dwmac *dwmac = priv;
-
- /* On socfpga platform exit, assert and hold reset to the
- * enet controller - the default state after a hard reset.
- */
- if (dwmac->stmmac_rst)
- reset_control_assert(dwmac->stmmac_rst);
-}
-
static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
{
- struct socfpga_dwmac *dwmac = priv;
+ struct socfpga_dwmac *dwmac = priv;
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *stpriv = NULL;
int ret = 0;
- if (ndev)
- stpriv = netdev_priv(ndev);
+ if (!ndev)
+ return -EINVAL;
+
+ stpriv = netdev_priv(ndev);
+ if (!stpriv)
+ return -EINVAL;
/* Assert reset to the enet controller before changing the phy mode */
- if (dwmac->stmmac_rst)
- reset_control_assert(dwmac->stmmac_rst);
+ if (stpriv->stmmac_rst)
+ reset_control_assert(stpriv->stmmac_rst);
/* Setup the phy mode in the system manager registers according to
* devicetree configuration
@@ -227,8 +210,8 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
/* Deassert reset for the phy configuration to be sampled by
* the enet controller, and operation to start in requested mode
*/
- if (dwmac->stmmac_rst)
- reset_control_deassert(dwmac->stmmac_rst);
+ if (stpriv->stmmac_rst)
+ reset_control_deassert(stpriv->stmmac_rst);
/* Before the enet controller is suspended, the phy is suspended.
* This causes the phy clock to be gated. The enet controller is
@@ -245,12 +228,37 @@ static int socfpga_dwmac_init(struct platform_device *pdev, void *priv)
* control register 0, and can be modified by the phy driver
* framework.
*/
- if (stpriv && stpriv->phydev)
+ if (stpriv->phydev)
phy_resume(stpriv->phydev);
return ret;
}
+static int socfpga_dwmac_init_probe(struct socfpga_dwmac *dwmac)
+{
+ struct reset_control *stmmac_rst;
+ int ret;
+
+ stmmac_rst = reset_control_get(dwmac->dev, STMMAC_RESOURCE_NAME);
+ if (IS_ERR(stmmac_rst)) {
+ dev_info(dwmac->dev, "Could not get reset control!\n");
+ if (PTR_ERR(stmmac_rst) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ }
+
+ if (stmmac_rst)
+ reset_control_assert(stmmac_rst);
+
+ ret = socfpga_dwmac_setup(dwmac);
+
+ if (stmmac_rst) {
+ reset_control_deassert(stmmac_rst);
+ reset_control_put(stmmac_rst);
+ }
+
+ return ret;
+}
+
static int socfpga_dwmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
@@ -279,10 +287,9 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
plat_dat->bsp_priv = dwmac;
plat_dat->init = socfpga_dwmac_init;
- plat_dat->exit = socfpga_dwmac_exit;
plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
- ret = socfpga_dwmac_init(pdev, plat_dat->bsp_priv);
+ ret = socfpga_dwmac_init_probe(dwmac);
if (ret)
return ret;
--
2.7.0
^ permalink raw reply related
* Re: [PATCH v2 1/1] drivers: net: cpsw: Prevent NUll pointer dereference with two PHYs
From: David Rivshin (Allworx) @ 2016-04-19 23:38 UTC (permalink / raw)
To: David Miller, grygorii.strashko
Cc: andrew.goodbody, netdev, linux-kernel, linux-omap, mugunthanvnm,
tony
In-Reply-To: <20160419.184339.1558043853032502121.davem@davemloft.net>
On Tue, 19 Apr 2016 18:43:39 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:
> From: Grygorii Strashko <grygorii.strashko@ti.com>
> Date: Tue, 19 Apr 2016 21:44:09 +0300
>
> > May be you can send revert + your patch 1 (only fix for this issue).
> >
> > Dave, Does that sound good to you?
>
> Sure.
OK, I will hopefully have that ready tomorrow evening.
Anything in particular I should mention in the revert commit message?
I didn't find a discussion on it, other than the earlier statement that
"it breaks boot on many TI boards".
^ permalink raw reply
* Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats
From: David Miller @ 2016-04-19 22:49 UTC (permalink / raw)
To: roopa; +Cc: eric.dumazet, netdev, jhs, tgraf, nicolas.dichtel
In-Reply-To: <5716815C.6080601@cumulusnetworks.com>
From: Roopa Prabhu <roopa@cumulusnetworks.com>
Date: Tue, 19 Apr 2016 12:05:00 -0700
> ok, will do. one thing though, for GETSTATS, if I need a pad
> attribute like IFLA_PAD, I will need to add a new stats attribute
> IFLA_STATS_PAD and burn a bit for it in filter_mask too. In which
> case, I am wondering if we should live with the copy. I will take
> any suggestions here.
I don't think the copy is appropriate, especially if the existing full
link state dump gets away without it. We're adding this facility for
performance reasons after all.
You have several options to avoid wasting filter mask space. For
example, you could use IFLA_STATS_UNSPEC, which should be OK since
only new applications will use these.
Or you could make IFLA_STATS_PAD the first attribute, and define the
filter mask as relative to it. Ie. IFLA_STATS_LINK_64 uses bit
(IFLA_STATS_LINK_64 - IFLA_STATS_PAD), etc.
^ permalink raw reply
* Re: [PATCH v2 1/1] drivers: net: cpsw: Prevent NUll pointer dereference with two PHYs
From: David Miller @ 2016-04-19 22:43 UTC (permalink / raw)
To: grygorii.strashko
Cc: drivshin.allworx, andrew.goodbody, netdev, linux-kernel,
linux-omap, mugunthanvnm, tony
In-Reply-To: <57167C79.20205@ti.com>
From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: Tue, 19 Apr 2016 21:44:09 +0300
> May be you can send revert + your patch 1 (only fix for this issue).
>
> Dave, Does that sound good to you?
Sure.
^ permalink raw reply
* Re: [PATCH 1/3] e1000e: e1000e_cyclecounter_read(): incvalue is 32 bits, not 64
From: Jeff Kirsher @ 2016-04-19 20:57 UTC (permalink / raw)
To: Denys Vlasenko; +Cc: David S. Miller, netdev
In-Reply-To: <1461069286-31946-1-git-send-email-dvlasenk@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]
On Tue, 2016-04-19 at 14:34 +0200, Denys Vlasenko wrote:
> "incvalue" variable holds a result of "er32(TIMINCA) &
> E1000_TIMINCA_INCVALUE_MASK"
> and used in "do_div(temp, incvalue)" as a divisor.
>
> Thus, "u64 incvalue" declaration is probably a mistake.
> Even though it seems to be a harmless one, let's fix it.
>
> Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
> CC: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> CC: Jesse Brandeburg <jesse.brandeburg@intel.com>
> CC: Shannon Nelson <shannon.nelson@intel.com>
> CC: Carolyn Wyborny <carolyn.wyborny@intel.com>
> CC: Don Skidmore <donald.c.skidmore@intel.com>
> CC: Bruce Allan <bruce.w.allan@intel.com>
> CC: John Ronciak <john.ronciak@intel.com>
> CC: Mitch Williams <mitch.a.williams@intel.com>
> CC: David S. Miller <davem@davemloft.net>
> CC: LKML <linux-kernel@vger.kernel.org>
> CC: netdev@vger.kernel.org
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
First of all, trimmed down the recipient list since almost all of the
reviewers you added have nothing to do with e1000e.
Any chance you can send this to the "correct" list intel-wired-
lan@lists.osuosl.org? Kind of amazing that your shotgun blast approach
in emailing out the patch series managed to miss sending it to the one
email list that handles Intel Wired LAN kernel patches.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH net-next v5] rtnetlink: add new RTM_GETSTATS message to dump link stats
From: Roopa Prabhu @ 2016-04-19 20:40 UTC (permalink / raw)
To: Paul Moore
Cc: nicolas.dichtel, netdev, jhs, davem, tgraf, Stephen Smalley,
Eric Paris
In-Reply-To: <CAHC9VhRjjWk9drwY5Db2Zwu1CHw+dxtkMKR6Ovw3pzuHBvieVQ@mail.gmail.com>
On 4/19/16, 12:55 PM, Paul Moore wrote:
> On Tue, Apr 19, 2016 at 4:26 AM, Nicolas Dichtel
> <nicolas.dichtel@6wind.com> wrote:
>> + selinux maintainers
>>
>> Le 18/04/2016 23:10, Roopa Prabhu a écrit :
>> [snip]
>>> diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c
>>> index 8495b93..1714633 100644
>>> --- a/security/selinux/nlmsgtab.c
>>> +++ b/security/selinux/nlmsgtab.c
>>> @@ -76,6 +76,8 @@ static struct nlmsg_perm nlmsg_route_perms[] =
>>> { RTM_NEWNSID, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
>>> { RTM_DELNSID, NETLINK_ROUTE_SOCKET__NLMSG_READ },
>>> { RTM_GETNSID, NETLINK_ROUTE_SOCKET__NLMSG_READ },
>>> + { RTM_NEWSTATS, NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
>> I would say it's NETLINK_ROUTE_SOCKET__NLMSG_READ, not WRITE. This command
>> is only sent by the kernel, not by the userland.
> From what I could tell from the patch description, it looks like
> RTM_NEWSTATS only dumps stats to userspace and doesn't alter the state
> of the kernel, is that correct? If so, then yes, NLMSG__READ is the
> right SELinux permission. However, if RTM_NEWSTATS does alter the
> state/configuration of the kernel then we should use NLMSG__WRITE.
>
okay, will change it to READ in the next version,
thanks.
^ permalink raw reply
* Re: [PATCH net 1/5] macsec: add missing NULL check after kmalloc
From: Sabrina Dubroca @ 2016-04-19 20:25 UTC (permalink / raw)
To: Lance Richardson
Cc: netdev, Hannes Frederic Sowa, Johannes Berg, Dan Carpenter
In-Reply-To: <1625750535.15145234.1461087947312.JavaMail.zimbra@redhat.com>
2016-04-19, 13:45:47 -0400, Lance Richardson wrote:
> ----- Original Message -----
> > From: "Sabrina Dubroca" <sd@queasysnail.net>
> > To: netdev@vger.kernel.org
> > Cc: "Hannes Frederic Sowa" <hannes@stressinduktion.org>, "Johannes Berg" <johannes@sipsolutions.net>, "Dan Carpenter"
> > <dan.carpenter@oracle.com>, "Sabrina Dubroca" <sd@queasysnail.net>
> > Sent: Tuesday, April 19, 2016 1:36:38 PM
> > Subject: [PATCH net 1/5] macsec: add missing NULL check after kmalloc
> >
> > Fixes: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver")
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> > Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> > ---
> > drivers/net/macsec.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
> > index 84d3e5ca8817..f691030ee3df 100644
> > --- a/drivers/net/macsec.c
> > +++ b/drivers/net/macsec.c
> > @@ -1622,8 +1622,8 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct
> > genl_info *info)
> > }
> >
> > rx_sa = kmalloc(sizeof(*rx_sa), GFP_KERNEL);
> > - if (init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]), secy->key_len,
> > - secy->icv_len)) {
> > + if (!rx_sa || init_rx_sa(rx_sa, nla_data(tb_sa[MACSEC_SA_ATTR_KEY]),
> > + secy->key_len, secy->icv_len)) {
>
> Doesn't this leak rx_sa if kmalloc() succeeds but init_rx_sa fails?
Yeah, you're right. And there's the same code around init_tx_sa.
I'll send v2 tomorrow with this and another fix.
Thanks!
> > rtnl_unlock();
> > return -ENOMEM;
> > }
> > --
> > 2.8.0
> >
> >
--
Sabrina
^ permalink raw reply
* Re: [Intel-wired-lan] i40e error handling LLDP messages from Arista switches
From: Jeremy Ashton @ 2016-04-19 20:20 UTC (permalink / raw)
To: Parikh, Neerav; +Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
In-Reply-To: <739353123C992A4C8800D77E2094259090524A59@ORSMSX103.amr.corp.intel.com>
Is there a way to disable the lldp daemon running in the firmware?
On Tue, Apr 19, 2016 at 2:31 PM, Parikh, Neerav <neerav.parikh@intel.com> wrote:
>
>
>> -----Original Message-----
>> From: Jeremy Ashton [mailto:jeremy.ashton@shopify.com]
>> Sent: Tuesday, April 19, 2016 11:10 AM
>> To: Parikh, Neerav <neerav.parikh@intel.com>
>> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org
>> Subject: Re: [Intel-wired-lan] i40e error handling LLDP messages from Arista
>> switches
>>
>> So, what commands exactly are you looking to have run? Would packet
>> capture of the lldp traffic help?
>>
> LLDP is running in the i40e device firmware so unless you've a packet capture on
> the wire (Xgig) you may not see that in the wireshark/tshark on the host system.
>
> The debugfs commands I was referring to below can help capture some
> information; and for that you may need to mount the debugfs file system on
> your setup. If debugfs is supported then once you've that mounted and have the
> i40e driver loaded then you may see an entry named "i40e" under the mount point.
> Assuming debugfs is mounted on /sys/kernel/debug the i40e directory will be under
> /sys/kernel/debug/i40e. This directory will have entry for each PCIe device being
> managed by the i40e driver. You can select the PCIe device that maps to the device
> in question and can run the commands like:
> echo "dump port" > /sys/kernel/debug/i40e/<pci-path>/command
> echo "lldp get local" > /sys/kernel/debug/i40e/<pci-path>/command
> echo "lldp get remote" > /sys/kernel/debug/i40e/<pci-path>/command
>
> The output of these commands will show up in the dmesg log.
>
> One another I noticed in your thread on the PF_RING bz is that you're using inbox
> Ubuntu driver. Have you tried with current upstream and seen this issue?
>
> Thanks,
> Neerav
>
>> On Tue, Apr 19, 2016 at 1:53 PM, Parikh, Neerav <neerav.parikh@intel.com>
>> wrote:
>> > Resending as the original email was sent in HTLM format and hence my reply
>> went in that format
>> > as well; which got rejected by netdev mailer.
>> >
>> >> -----Original Message-----
>> >> From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
>> Behalf Of Parikh, Neerav
>> >> Sent: Tuesday, April 19, 2016 10:45 AM
>> >> To: Jeremy Ashton <jeremy.ashton@shopify.com>
>> >> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org
>> >> Subject: Re: [Intel-wired-lan] i40e error handling LLDP messages from Arista
>> switches
>> >>
>> >> > From: Intel-wired-lan [mailto:intel-wired-lan-bounces@lists.osuosl.org] On
>> Behalf Of Jeremy Ashton
>> >> > Sent: Tuesday, April 19, 2016 10:26 AM
>> >> > Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org
>> >> > Subject: [Intel-wired-lan] i40e error handling LLDP messages from Arista
>> switches
>> >> >
>> >> > I have been trying to get pf_ring with zc running on ubuntu 14.04. The
>> thread can be found here:
>> >> >
>> >> > https://github.com/ntop/PF_RING/issues/81
>> >> >
>> >> > Unfortunately it seems there is a bug in i40e which is carried into the code
>> base for i40e_zc.
>> >> >
>> >> > $ modinfo i40e
>> >> > filename: /lib/modules/3.19.0-58-
>> generic/kernel/drivers/net/ethernet/intel/i40e/i40e.ko
>> >> > version: 1.2.2-k
>> >> > license: GPL
>> >> > description: Intel(R) Ethernet Connection XL710 Network Driver
>> >> > author: Intel Corporation, <e1000-devel@lists.sourceforge.net>
>> >> > srcversion: E3DEEE00F49BBFBB8FF33A7
>> >> > alias: pci:v00008086d00001586sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001585sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001584sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001583sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001581sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001580sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d0000157Fsv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001574sv*sd*bc*sc*i*
>> >> > alias: pci:v00008086d00001572sv*sd*bc*sc*i*
>> >> > depends: ptp,vxlan
>> >> > intree: Y
>> >> > vermagic: 3.19.0-58-generic SMP mod_unload modversions
>> >> > signer: Magrathea: Glacier signing key
>> >> > sig_key:
>> DE:B3:43:0A:26:E6:7D:3D:3B:54:B9:DD:13:25:B3:3A:46:B2:F2:DD
>> >> > sig_hashalgo: sha512
>> >> > part: debug:Debug level (0=none,...,16=all) (int)
>> >> >
>> >> >
>> >> > I wonder if someone might offer some insight as to the next steps to
>> debug/resolve this.
>> >> >
>> >> > Cheers.
>> >> >
>> >> > Can you send us the dmesg output after running i40e debugfs commands
>> >> > viz. “dump port”, “llpd get local” , “lldp get remote”, for the port that is
>> showing
>> >> > this behavior? Also, do you happen to know what is the Arista side
>> configuration?
>> >> > This will help us debug better.
>> >> >
>> >> > Thanks,
>> >> > Neerav
^ permalink raw reply
* 4.4.0 - e1000e - possible power management issue
From: Nikola Ciprich @ 2016-04-19 19:53 UTC (permalink / raw)
To: netdev; +Cc: nikola.ciprich
[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]
Hi,
after upgrading our firewall from 4.1.17 to 4.4.0, we've noticed quite a performance
drop.. Slight network load seems to cause high CPU load..
running perf of almost idle system shows:
samples pcnt function DSO
_______ _____ _______________________________________ ___________________________________________________________________________
631.00 20.7% e1000_power_down_phy_copper_80003es2lan /lib/modules/4.4.0lb6.01/kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko
191.00 6.3% do_raw_spin_lock [kernel.kallsyms]
165.00 5.4% ipt_register_table /lib/modules/4.4.0lb6.01/kernel/net/ipv4/netfilter/ip_tables.ko
119.00 3.9% cache_init /usr/sbin/netstat-probe
118.00 3.9% __memset_sse2 /lib64/libc-2.12.so
88.00 2.9% cache_write_packet /usr/sbin/netstat-probe
41.00 1.3% __fget [kernel.kallsyms]
40.00 1.3% memcpy [kernel.kallsyms]
when there is some network traffic, e1000_power_down_phy_copper_80003es2lan jumps to much higher
numbers.. as far as I understand the code, this seems suspicious to me..
Anyone hit the same problem?
I can try upgrading to 4.4.8-rc1 tomorrow or reverting to 4.1.17
lspci of the box adapters:
05:00.0 Ethernet controller: Intel Corporation 82573E Gigabit Ethernet Controller (Copper) (rev 03)
07:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
09:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
0b:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
BR
nik
--
-------------------------------------
Ing. Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 00 Ostrava
tel.: +420 591 166 214
fax: +420 596 621 273
mobil: +420 777 093 799
www.linuxbox.cz
mobil servis: +420 737 238 656
email servis: servis@linuxbox.cz
-------------------------------------
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* [PATCH net-next V4 2/2] intel: ixgbevf: Support Windows hosts (Hyper-V)
From: K. Y. Srinivasan @ 2016-04-19 20:12 UTC (permalink / raw)
To: davem, netdev, linux-kernel, devel, olaf, apw, jasowang, eli,
jackm, yevgenyp, john.ronciak, intel-wired-lan, alexander.duyck
In-Reply-To: <1461096723-26471-1-git-send-email-kys@microsoft.com>
On Hyper-V, the VF/PF communication is a via software mediated path
as opposed to the hardware mailbox. Make the necessary
adjustments to support Hyper-V.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
V2: Addressed most of the comments from
Alexander Duyck <alexander.duyck@gmail.com>
and Rustad, Mark D <mark.d.rustad@intel.com>.
V3: Addressed additional comments from
Alexander Duyck <alexander.duyck@gmail.com>
V4: Addressed kbuild errors reported by:
kbuild test robot <lkp@intel.com>
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 12 ++
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 31 +++-
drivers/net/ethernet/intel/ixgbevf/mbx.c | 12 ++
drivers/net/ethernet/intel/ixgbevf/vf.c | 216 +++++++++++++++++++++
drivers/net/ethernet/intel/ixgbevf/vf.h | 2 +
5 files changed, 266 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index 5ac60ee..3296d27 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -460,9 +460,13 @@ enum ixbgevf_state_t {
enum ixgbevf_boards {
board_82599_vf,
+ board_82599_vf_hv,
board_X540_vf,
+ board_X540_vf_hv,
board_X550_vf,
+ board_X550_vf_hv,
board_X550EM_x_vf,
+ board_X550EM_x_vf_hv,
};
enum ixgbevf_xcast_modes {
@@ -477,6 +481,13 @@ extern const struct ixgbevf_info ixgbevf_X550_vf_info;
extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info;
extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;
+
+extern const struct ixgbevf_info ixgbevf_82599_vf_hv_info;
+extern const struct ixgbevf_info ixgbevf_X540_vf_hv_info;
+extern const struct ixgbevf_info ixgbevf_X550_vf_hv_info;
+extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info;
+extern const struct ixgbe_mbx_operations ixgbevf_hv_mbx_ops;
+
/* needed by ethtool.c */
extern const char ixgbevf_driver_name[];
extern const char ixgbevf_driver_version[];
@@ -494,6 +505,7 @@ void ixgbevf_free_rx_resources(struct ixgbevf_ring *);
void ixgbevf_free_tx_resources(struct ixgbevf_ring *);
void ixgbevf_update_stats(struct ixgbevf_adapter *adapter);
int ethtool_ioctl(struct ifreq *ifr);
+bool ixgbevf_on_hyperv(struct ixgbe_hw *hw);
extern void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector);
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 007cbe0..c4bb480 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -62,10 +62,14 @@ static char ixgbevf_copyright[] =
"Copyright (c) 2009 - 2015 Intel Corporation.";
static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
- [board_82599_vf] = &ixgbevf_82599_vf_info,
- [board_X540_vf] = &ixgbevf_X540_vf_info,
- [board_X550_vf] = &ixgbevf_X550_vf_info,
- [board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,
+ [board_82599_vf] = &ixgbevf_82599_vf_info,
+ [board_82599_vf_hv] = &ixgbevf_82599_vf_hv_info,
+ [board_X540_vf] = &ixgbevf_X540_vf_info,
+ [board_X540_vf_hv] = &ixgbevf_X540_vf_hv_info,
+ [board_X550_vf] = &ixgbevf_X550_vf_info,
+ [board_X550_vf_hv] = &ixgbevf_X550_vf_hv_info,
+ [board_X550EM_x_vf] = &ixgbevf_X550EM_x_vf_info,
+ [board_X550EM_x_vf_hv] = &ixgbevf_X550EM_x_vf_hv_info,
};
/* ixgbevf_pci_tbl - PCI Device ID Table
@@ -78,9 +82,13 @@ static const struct ixgbevf_info *ixgbevf_info_tbl[] = {
*/
static const struct pci_device_id ixgbevf_pci_tbl[] = {
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF), board_82599_vf },
+ {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82599_VF_HV), board_82599_vf_hv },
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF), board_X540_vf },
+ {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X540_VF_HV), board_X540_vf_hv },
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF), board_X550_vf },
+ {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550_VF_HV), board_X550_vf_hv },
{PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF), board_X550EM_x_vf },
+ {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_X550EM_X_VF_HV), board_X550EM_x_vf_hv},
/* required last entry */
{0, }
};
@@ -1795,7 +1803,10 @@ static void ixgbevf_configure_rx(struct ixgbevf_adapter *adapter)
ixgbevf_setup_vfmrqc(adapter);
/* notify the PF of our intent to use this size of frame */
- ixgbevf_rlpml_set_vf(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);
+ if (!ixgbevf_on_hyperv(hw))
+ ixgbevf_rlpml_set_vf(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);
+ else
+ ixgbevf_hv_rlpml_set_vf(hw, netdev->mtu + ETH_HLEN + ETH_FCS_LEN);
/* Setup the HW Rx Head and Tail Descriptor Pointers and
* the Base and Length of the Rx Descriptor Ring
@@ -2056,7 +2067,10 @@ static void ixgbevf_negotiate_api(struct ixgbevf_adapter *adapter)
spin_lock_bh(&adapter->mbx_lock);
while (api[idx] != ixgbe_mbox_api_unknown) {
- err = ixgbevf_negotiate_api_version(hw, api[idx]);
+ if (!ixgbevf_on_hyperv(hw))
+ err = ixgbevf_negotiate_api_version(hw, api[idx]);
+ else
+ err = ixgbevf_hv_negotiate_api_version(hw, api[idx]);
if (!err)
break;
idx++;
@@ -3727,7 +3741,10 @@ static int ixgbevf_change_mtu(struct net_device *netdev, int new_mtu)
netdev->mtu = new_mtu;
/* notify the PF of our intent to use this size of frame */
- ixgbevf_rlpml_set_vf(hw, max_frame);
+ if (!ixgbevf_on_hyperv(hw))
+ ixgbevf_rlpml_set_vf(hw, max_frame);
+ else
+ ixgbevf_hv_rlpml_set_vf(hw, max_frame);
return 0;
}
diff --git a/drivers/net/ethernet/intel/ixgbevf/mbx.c b/drivers/net/ethernet/intel/ixgbevf/mbx.c
index dc68fea..298a0da 100644
--- a/drivers/net/ethernet/intel/ixgbevf/mbx.c
+++ b/drivers/net/ethernet/intel/ixgbevf/mbx.c
@@ -346,3 +346,15 @@ const struct ixgbe_mbx_operations ixgbevf_mbx_ops = {
.check_for_rst = ixgbevf_check_for_rst_vf,
};
+/**
+ * Mailbox operations when running on Hyper-V.
+ * On Hyper-V, PF/VF communiction is not through the
+ * hardware mailbox; this communication is through
+ * a software mediated path.
+ * Most mail box operations are noop while running on
+ * Hyper-V.
+ */
+const struct ixgbe_mbx_operations ixgbevf_hv_mbx_ops = {
+ .init_params = ixgbevf_init_mbx_params_vf,
+ .check_for_rst = ixgbevf_check_for_rst_vf,
+};
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index 4d613a4..8f277b9 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -27,6 +27,13 @@
#include "vf.h"
#include "ixgbevf.h"
+/*
+ * On Hyper-V, to reset, we need to read from this offset
+ * from the PCI config space. This is the mechanism used on
+ * Hyper-V to support PF/VF communication.
+ */
+#define IXGBE_HV_RESET_OFFSET 0x201
+
/**
* ixgbevf_start_hw_vf - Prepare hardware for Tx/Rx
* @hw: pointer to hardware structure
@@ -126,6 +133,27 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw)
}
/**
+ * Hyper-V variant; the VF/PF communication is through the PCI
+ * config space.
+ */
+static s32 ixgbevf_hv_reset_hw_vf(struct ixgbe_hw *hw)
+{
+#if IS_ENABLED(CONFIG_PCI_MMCONFIG)
+ struct ixgbevf_adapter *adapter = hw->back;
+ int i;
+
+ for (i = 0; i < 6; i++)
+ pci_read_config_byte(adapter->pdev,
+ (i + IXGBE_HV_RESET_OFFSET),
+ &hw->mac.perm_addr[i]);
+#else
+ pr_err("PCI_MMCONFIG needs to be enabled for Hyper-V\n");
+#endif
+
+ return 0;
+}
+
+/**
* ixgbevf_stop_hw_vf - Generic stop Tx/Rx units
* @hw: pointer to hardware structure
*
@@ -258,6 +286,11 @@ static s32 ixgbevf_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
return ret_val;
}
+static s32 ixgbevf_hv_set_uc_addr_vf(struct ixgbe_hw *hw, u32 index, u8 *addr)
+{
+ return -EOPNOTSUPP;
+}
+
/**
* ixgbevf_get_reta_locked - get the RSS redirection table (RETA) contents.
* @adapter: pointer to the port handle
@@ -416,6 +449,26 @@ static s32 ixgbevf_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
return ret_val;
}
+/**
+ * ixgbevf_hv_set_rar_vf - set device MAC address Hyper-V variant
+ * @hw: pointer to hardware structure
+ * @index: Receive address register to write
+ * @addr: Address to put into receive address register
+ * @vmdq: Unused in this implementation
+ *
+ * We don't really allow setting the device MAC address. However,
+ * if the address being set is the permanent MAC address we will
+ * permit that.
+ **/
+static s32 ixgbevf_hv_set_rar_vf(struct ixgbe_hw *hw, u32 index, u8 *addr,
+ u32 vmdq)
+{
+ if (ether_addr_equal(addr, hw->mac.perm_addr))
+ return 0;
+
+ return -EOPNOTSUPP;
+}
+
static void ixgbevf_write_msg_read_ack(struct ixgbe_hw *hw,
u32 *msg, u16 size)
{
@@ -473,6 +526,15 @@ static s32 ixgbevf_update_mc_addr_list_vf(struct ixgbe_hw *hw,
}
/**
+ * Hyper-V variant - just a stub.
+ */
+static s32 ixgbevf_hv_update_mc_addr_list_vf(struct ixgbe_hw *hw,
+ struct net_device *netdev)
+{
+ return -EOPNOTSUPP;
+}
+
+/**
* ixgbevf_update_xcast_mode - Update Multicast mode
* @hw: pointer to the HW structure
* @netdev: pointer to net device structure
@@ -513,6 +575,15 @@ static s32 ixgbevf_update_xcast_mode(struct ixgbe_hw *hw,
}
/**
+ * Hyper-V variant - just a stub.
+ */
+static s32 ixgbevf_hv_update_xcast_mode(struct ixgbe_hw *hw,
+ struct net_device *netdev, int xcast_mode)
+{
+ return -EOPNOTSUPP;
+}
+
+/**
* ixgbevf_set_vfta_vf - Set/Unset VLAN filter table address
* @hw: pointer to the HW structure
* @vlan: 12 bit VLAN ID
@@ -551,6 +622,15 @@ mbx_err:
}
/**
+ * Hyper-V variant - just a stub.
+ */
+static s32 ixgbevf_hv_set_vfta_vf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
+ bool vlan_on)
+{
+ return -EOPNOTSUPP;
+}
+
+/**
* ixgbevf_setup_mac_link_vf - Setup MAC link settings
* @hw: pointer to hardware structure
* @speed: Unused in this implementation
@@ -656,6 +736,67 @@ out:
}
/**
+ * Hyper-V variant; there is no mailbox communication.
+ */
+static s32 ixgbevf_hv_check_mac_link_vf(struct ixgbe_hw *hw,
+ ixgbe_link_speed *speed,
+ bool *link_up,
+ bool autoneg_wait_to_complete)
+{
+ struct ixgbe_mbx_info *mbx = &hw->mbx;
+ struct ixgbe_mac_info *mac = &hw->mac;
+ u32 links_reg;
+
+ /* If we were hit with a reset drop the link */
+ if (!mbx->ops.check_for_rst(hw) || !mbx->timeout)
+ mac->get_link_status = true;
+
+ if (!mac->get_link_status)
+ goto out;
+
+ /* if link status is down no point in checking to see if pf is up */
+ links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
+ if (!(links_reg & IXGBE_LINKS_UP))
+ goto out;
+
+ /* for SFP+ modules and DA cables on 82599 it can take up to 500usecs
+ * before the link status is correct
+ */
+ if (mac->type == ixgbe_mac_82599_vf) {
+ int i;
+
+ for (i = 0; i < 5; i++) {
+ udelay(100);
+ links_reg = IXGBE_READ_REG(hw, IXGBE_VFLINKS);
+
+ if (!(links_reg & IXGBE_LINKS_UP))
+ goto out;
+ }
+ }
+
+ switch (links_reg & IXGBE_LINKS_SPEED_82599) {
+ case IXGBE_LINKS_SPEED_10G_82599:
+ *speed = IXGBE_LINK_SPEED_10GB_FULL;
+ break;
+ case IXGBE_LINKS_SPEED_1G_82599:
+ *speed = IXGBE_LINK_SPEED_1GB_FULL;
+ break;
+ case IXGBE_LINKS_SPEED_100_82599:
+ *speed = IXGBE_LINK_SPEED_100_FULL;
+ break;
+ }
+
+ /* if we passed all the tests above then the link is up and we no
+ * longer need to check for link
+ */
+ mac->get_link_status = false;
+
+out:
+ *link_up = !mac->get_link_status;
+ return 0;
+}
+
+/**
* ixgbevf_rlpml_set_vf - Set the maximum receive packet length
* @hw: pointer to the HW structure
* @max_size: value to assign to max frame size
@@ -670,6 +811,25 @@ void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
}
/**
+ * ixgbevf_hv_rlpml_set_vf - Set the maximum receive packet length
+ * @hw: pointer to the HW structure
+ * @max_size: value to assign to max frame size
+ * Hyper-V variant.
+ **/
+void ixgbevf_hv_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size)
+{
+ u32 reg;
+
+ /* If we are on Hyper-V, we implement
+ * this functionality differently.
+ */
+ reg = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(0));
+ /* CRC == 4 */
+ reg |= ((max_size + 4) | IXGBE_RXDCTL_RLPML_EN);
+ IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(0), reg);
+}
+
+/**
* ixgbevf_negotiate_api_version - Negotiate supported API version
* @hw: pointer to the HW structure
* @api: integer containing requested API version
@@ -703,6 +863,22 @@ int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api)
return err;
}
+/**
+ * ixgbevf_hv_negotiate_api_version - Negotiate supported API version
+ * @hw: pointer to the HW structure
+ * @api: integer containing requested API version
+ * Hyper-V version - only ixgbe_mbox_api_10 supported.
+ **/
+int ixgbevf_hv_negotiate_api_version(struct ixgbe_hw *hw, int api)
+{
+ /* Hyper-V only supports api version ixgbe_mbox_api_10
+ */
+ if (api != ixgbe_mbox_api_10)
+ return IXGBE_ERR_INVALID_ARGUMENT;
+
+ return 0;
+}
+
int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
unsigned int *default_tc)
{
@@ -776,22 +952,62 @@ static const struct ixgbe_mac_operations ixgbevf_mac_ops = {
.set_vfta = ixgbevf_set_vfta_vf,
};
+static const struct ixgbe_mac_operations ixgbevf_hv_mac_ops = {
+ .init_hw = ixgbevf_init_hw_vf,
+ .reset_hw = ixgbevf_hv_reset_hw_vf,
+ .start_hw = ixgbevf_start_hw_vf,
+ .get_mac_addr = ixgbevf_get_mac_addr_vf,
+ .stop_adapter = ixgbevf_stop_hw_vf,
+ .setup_link = ixgbevf_setup_mac_link_vf,
+ .check_link = ixgbevf_hv_check_mac_link_vf,
+ .set_rar = ixgbevf_hv_set_rar_vf,
+ .update_mc_addr_list = ixgbevf_hv_update_mc_addr_list_vf,
+ .update_xcast_mode = ixgbevf_hv_update_xcast_mode,
+ .set_uc_addr = ixgbevf_hv_set_uc_addr_vf,
+ .set_vfta = ixgbevf_hv_set_vfta_vf,
+};
+
const struct ixgbevf_info ixgbevf_82599_vf_info = {
.mac = ixgbe_mac_82599_vf,
.mac_ops = &ixgbevf_mac_ops,
};
+const struct ixgbevf_info ixgbevf_82599_vf_hv_info = {
+ .mac = ixgbe_mac_82599_vf,
+ .mac_ops = &ixgbevf_hv_mac_ops,
+};
+
const struct ixgbevf_info ixgbevf_X540_vf_info = {
.mac = ixgbe_mac_X540_vf,
.mac_ops = &ixgbevf_mac_ops,
};
+const struct ixgbevf_info ixgbevf_X540_vf_hv_info = {
+ .mac = ixgbe_mac_X540_vf,
+ .mac_ops = &ixgbevf_hv_mac_ops,
+};
+
const struct ixgbevf_info ixgbevf_X550_vf_info = {
.mac = ixgbe_mac_X550_vf,
.mac_ops = &ixgbevf_mac_ops,
};
+const struct ixgbevf_info ixgbevf_X550_vf_hv_info = {
+ .mac = ixgbe_mac_X550_vf,
+ .mac_ops = &ixgbevf_hv_mac_ops,
+};
+
const struct ixgbevf_info ixgbevf_X550EM_x_vf_info = {
.mac = ixgbe_mac_X550EM_x_vf,
.mac_ops = &ixgbevf_mac_ops,
};
+
+const struct ixgbevf_info ixgbevf_X550EM_x_vf_hv_info = {
+ .mac = ixgbe_mac_X550EM_x_vf,
+ .mac_ops = &ixgbevf_hv_mac_ops,
+};
+
+bool ixgbevf_on_hyperv(struct ixgbe_hw *hw)
+{
+ return hw->mbx.ops.check_for_msg == NULL;
+}
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index ef9f773..658883e 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -208,7 +208,9 @@ static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg,
#define IXGBE_READ_REG_ARRAY(h, r, o) ixgbe_read_reg_array(h, r, o)
void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
+void ixgbevf_hv_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
+int ixgbevf_hv_negotiate_api_version(struct ixgbe_hw *hw, int api);
int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
unsigned int *default_tc);
int ixgbevf_get_reta_locked(struct ixgbe_hw *hw, u32 *reta, int num_rx_queues);
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox