* [PATCH iproute2 v2 2/4] color: Fix another ip segfault when using --color switch
From: Petr Vorel @ 2017-10-13 13:57 UTC (permalink / raw)
To: netdev; +Cc: Petr Vorel, Julien Fortin, Stephen Hemminger
In-Reply-To: <20171013135719.18450-1-petr.vorel@gmail.com>
Commit 959f1428 ("color: add new COLOR_NONE and disable_color function")
introducing color enum COLOR_NONE, which is not only duplicite of
COLOR_CLEAR, but also caused segfault, when running ip with --color
switch, as 'attr + 8' in color_fprintf() access array item out of
bounds. Thus removing it and restoring "magic" offset + 7.
Reproduce with:
$ ip -c a
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
include/color.h | 1 -
lib/color.c | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/color.h b/include/color.h
index 1cd6f7d2..c183ef79 100644
--- a/include/color.h
+++ b/include/color.h
@@ -2,7 +2,6 @@
#define __COLOR_H__ 1
enum color_attr {
- COLOR_NONE,
COLOR_IFNAME,
COLOR_MAC,
COLOR_INET,
diff --git a/lib/color.c b/lib/color.c
index 79d5e289..05afcb21 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -104,13 +104,13 @@ int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...)
va_start(args, fmt);
- if (!color_is_enabled || attr == COLOR_NONE) {
+ if (!color_is_enabled || attr == COLOR_CLEAR) {
ret = vfprintf(fp, fmt, args);
goto end;
}
ret += fprintf(fp, "%s",
- color_codes[attr_colors[is_dark_bg ? attr + 8 : attr]]);
+ color_codes[attr_colors[is_dark_bg ? attr + 7 : attr]]);
ret += vfprintf(fp, fmt, args);
ret += fprintf(fp, "%s", color_codes[C_CLEAR]);
--
2.14.2
^ permalink raw reply related
* [PATCH iproute2 v2 3/4] color: Cleanup code to remove "magic" offset + 7
From: Petr Vorel @ 2017-10-13 13:57 UTC (permalink / raw)
To: netdev; +Cc: Petr Vorel, Julien Fortin, Stephen Hemminger
In-Reply-To: <20171013135719.18450-1-petr.vorel@gmail.com>
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
lib/color.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/color.c b/lib/color.c
index 05afcb21..497f5e1b 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -45,8 +45,8 @@ static const char * const color_codes[] = {
NULL,
};
-static enum color attr_colors[] = {
- /* light background */
+/* light background */
+static enum color attr_colors_light[] = {
C_CYAN,
C_YELLOW,
C_MAGENTA,
@@ -54,8 +54,10 @@ static enum color attr_colors[] = {
C_GREEN,
C_RED,
C_CLEAR,
+};
- /* dark background */
+/* dark background */
+static enum color attr_colors_dark[] = {
C_BOLD_CYAN,
C_BOLD_YELLOW,
C_BOLD_MAGENTA,
@@ -109,8 +111,9 @@ int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...)
goto end;
}
- ret += fprintf(fp, "%s",
- color_codes[attr_colors[is_dark_bg ? attr + 7 : attr]]);
+ ret += fprintf(fp, "%s", color_codes[is_dark_bg ?
+ attr_colors_dark[attr] : attr_colors_light[attr]]);
+
ret += vfprintf(fp, fmt, args);
ret += fprintf(fp, "%s", color_codes[C_CLEAR]);
--
2.14.2
^ permalink raw reply related
* [PATCH iproute2 v2 4/4] color: Rename enum
From: Petr Vorel @ 2017-10-13 13:57 UTC (permalink / raw)
To: netdev; +Cc: Petr Vorel, Julien Fortin, Stephen Hemminger
In-Reply-To: <20171013135719.18450-1-petr.vorel@gmail.com>
COLOR_NONE is more descriptive than COLOR_CLEAR.
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
include/color.h | 2 +-
include/json_print.h | 2 +-
lib/color.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/color.h b/include/color.h
index c183ef79..7fd685d0 100644
--- a/include/color.h
+++ b/include/color.h
@@ -8,7 +8,7 @@ enum color_attr {
COLOR_INET6,
COLOR_OPERSTATE_UP,
COLOR_OPERSTATE_DOWN,
- COLOR_CLEAR
+ COLOR_NONE
};
void enable_color(void);
diff --git a/include/json_print.h b/include/json_print.h
index 596af35a..dc4d2bb3 100644
--- a/include/json_print.h
+++ b/include/json_print.h
@@ -53,7 +53,7 @@ void close_json_array(enum output_type type, const char *delim);
const char *fmt, \
type value) \
{ \
- print_color_##type_name(t, COLOR_CLEAR, key, fmt, value); \
+ print_color_##type_name(t, COLOR_NONE, key, fmt, value); \
}
_PRINT_FUNC(int, int);
_PRINT_FUNC(bool, bool);
diff --git a/lib/color.c b/lib/color.c
index 497f5e1b..8d049a01 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -106,7 +106,7 @@ int color_fprintf(FILE *fp, enum color_attr attr, const char *fmt, ...)
va_start(args, fmt);
- if (!color_is_enabled || attr == COLOR_CLEAR) {
+ if (!color_is_enabled || attr == COLOR_NONE) {
ret = vfprintf(fp, fmt, args);
goto end;
}
@@ -130,7 +130,7 @@ enum color_attr ifa_family_color(__u8 ifa_family)
case AF_INET6:
return COLOR_INET6;
default:
- return COLOR_CLEAR;
+ return COLOR_NONE;
}
}
@@ -142,6 +142,6 @@ enum color_attr oper_state_color(__u8 state)
case IF_OPER_DOWN:
return COLOR_OPERSTATE_DOWN;
default:
- return COLOR_CLEAR;
+ return COLOR_NONE;
}
}
--
2.14.2
^ permalink raw reply related
* Re: [PATCH net-next v2 0/2] net: stmmac: Improvements for multi-queuing and for AVB
From: Giuseppe CAVALLARO @ 2017-10-13 13:59 UTC (permalink / raw)
To: Jose Abreu, netdev; +Cc: David S. Miller, Joao Pinto, Alexandre Torgue
In-Reply-To: <cover.1507888312.git.joabreu@synopsys.com>
Yes you need these settings, thx for these patches.
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
On 10/13/2017 11:58 AM, Jose Abreu wrote:
> Hi,
>
> Two improvements for stmmac: First one corrects the available fifo size per queue, second one corrects enabling of AVB queues. More info in commit log.
>
> Best regards,
> Jose Miguel Abreu
>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Joao Pinto <jpinto@synopsys.com>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
>
> Changes from v1:
> - Fix typo in second patch
>
> Jose Abreu (2):
> net: stmmac: Use correct values in TQS/RQS fields
> net: stmmac: Disable flow ctrl for RX AVB queues and really enable TX
> AVB queues
>
> drivers/net/ethernet/stmicro/stmmac/common.h | 5 +--
> drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 2 ++
> drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c | 27 ++++++++++------
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 39 +++++++++++++++++++----
> 4 files changed, 56 insertions(+), 17 deletions(-)
>
^ permalink raw reply
* RE: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member
From: David Laight @ 2017-10-13 14:02 UTC (permalink / raw)
To: 'Florian Fainelli', Vivien Didelot,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
David S. Miller, Andrew Lunn
In-Reply-To: <5b637ea3-6c4b-1d93-ed43-09038af473f9@gmail.com>
From: Florian Fainelli
> Sent: 13 October 2017 00:05
...
> How about using:
>
> union {
> struct net_device *master;
> struct net_device *slave;
> } netdev;
...
You can remove the 'netdev' all the compilers support unnamed unions.
David
^ permalink raw reply
* Re: [patch net-next 00/34] net: sched: allow qdiscs to share filter block instances
From: David Ahern @ 2017-10-13 14:20 UTC (permalink / raw)
To: Jiri Pirko
Cc: netdev, davem, jhs, xiyou.wangcong, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, jeffrey.t.kirsher, saeedm,
matanb, leonro, idosch, jakub.kicinski, ast, daniel, simon.horman,
pieter.jansenvanvuuren, john.hurley, edumazet, alexander.h.duyck,
john.fastabend, willemb
In-Reply-To: <20171013062629.GB1952@nanopsycho.orion>
On 10/13/17 12:26 AM, Jiri Pirko wrote:
> Thu, Oct 12, 2017 at 11:37:30PM CEST, dsahern@gmail.com wrote:
>> On 10/12/17 11:17 AM, Jiri Pirko wrote:
>>> So back to the example. First, we create 2 qdiscs. Both will share
>>> block number 22. "22" is just an identification. If we don't pass any
>>> block number, a new one will be generated by kernel:
>>>
>>> $ tc qdisc add dev ens7 ingress block 22
>>> ^^^^^^^^
>>> $ tc qdisc add dev ens8 ingress block 22
>>> ^^^^^^^^
>>>
>>> Now if we list the qdiscs, we will see the block index in the output:
>>>
>>> $ tc qdisc
>>> qdisc ingress ffff: dev ens7 parent ffff:fff1 block 22
>>> qdisc ingress ffff: dev ens8 parent ffff:fff1 block 22
>>>
>>> Now we can add filter to any of qdiscs sharing the same block:
>>>
>>> $ tc filter add dev ens7 parent ffff: protocol ip pref 25 flower dst_ip 192.168.0.0/16 action drop
>>>
>>>
>>> We will see the same output if we list filters for ens7 and ens8, including stats:
>>>
>>> $ tc -s filter show dev ens7 ingress
>>> filter protocol ip pref 25 flower chain 0
>>> filter protocol ip pref 25 flower chain 0 handle 0x1
>>> eth_type ipv4
>>> dst_ip 192.168.0.0/16
>>> not_in_hw
>>> action order 1: gact action drop
>>> random type none pass val 0
>>> index 1 ref 1 bind 1 installed 39 sec used 2 sec
>>> Action statistics:
>>> Sent 3108 bytes 37 pkt (dropped 37, overlimits 0 requeues 0)
>>> backlog 0b 0p requeues 0
>>>
>>> $ tc -s filter show dev ens8 ingress
>>> filter protocol ip pref 25 flower chain 0
>>> filter protocol ip pref 25 flower chain 0 handle 0x1
>>> eth_type ipv4
>>> dst_ip 192.168.0.0/16
>>> not_in_hw
>>> action order 1: gact action drop
>>> random type none pass val 0
>>> index 1 ref 1 bind 1 installed 40 sec used 3 sec
>>> Action statistics:
>>> Sent 3108 bytes 37 pkt (dropped 37, overlimits 0 requeues 0)
>>> backlog 0b 0p requeues 0
>>
>> This seems like really odd semantics to me ... a filter added to one
>> device shows up on another.
>
> Why is it odd? They share the same block, so it is natural that rule
> added to one shows in list of rules for all devices that share the same
> block.
>
>
>>
>> Why not make the shared block a standalone object that is configured
>> through its own set of commands and then referenced by both devices?
>
> I was thinking about that for a long time. That would require entirely
> new set of netlink api and internal kernel handling just for this. Lots
> of duplications. The reason is, the current API is strictly build around
> ifindex. But the new API would not solve anything. As a user, I still
> want so see shared rules in individial device listing, because they
> would get processed for the device. So I believe that the proposed
> behaviour is correct.
>
netconf has NETCONFA_IFINDEX_ALL to keep the device concept but to relay
information that applies to more than 1 device. You could have something
similar for tc and shared blocks. Admin is done on this device index
(e.g., your shared block 22 becomes dev index -22) and the filters are
attached to another device for sharing using the 'qdisc add' command above.
^ permalink raw reply
* Re: [patch net-next 00/34] net: sched: allow qdiscs to share filter block instances
From: Jiri Pirko @ 2017-10-13 14:24 UTC (permalink / raw)
To: David Ahern
Cc: netdev, davem, jhs, xiyou.wangcong, mlxsw, andrew, vivien.didelot,
f.fainelli, michael.chan, ganeshgr, jeffrey.t.kirsher, saeedm,
matanb, leonro, idosch, jakub.kicinski, ast, daniel, simon.horman,
pieter.jansenvanvuuren, john.hurley, edumazet, alexander.h.duyck,
john.fastabend, willemb
In-Reply-To: <8ab85693-a2db-0084-a97b-4a8c6037196b@gmail.com>
Fri, Oct 13, 2017 at 04:20:38PM CEST, dsahern@gmail.com wrote:
>On 10/13/17 12:26 AM, Jiri Pirko wrote:
>> Thu, Oct 12, 2017 at 11:37:30PM CEST, dsahern@gmail.com wrote:
>>> On 10/12/17 11:17 AM, Jiri Pirko wrote:
>>>> So back to the example. First, we create 2 qdiscs. Both will share
>>>> block number 22. "22" is just an identification. If we don't pass any
>>>> block number, a new one will be generated by kernel:
>>>>
>>>> $ tc qdisc add dev ens7 ingress block 22
>>>> ^^^^^^^^
>>>> $ tc qdisc add dev ens8 ingress block 22
>>>> ^^^^^^^^
>>>>
>>>> Now if we list the qdiscs, we will see the block index in the output:
>>>>
>>>> $ tc qdisc
>>>> qdisc ingress ffff: dev ens7 parent ffff:fff1 block 22
>>>> qdisc ingress ffff: dev ens8 parent ffff:fff1 block 22
>>>>
>>>> Now we can add filter to any of qdiscs sharing the same block:
>>>>
>>>> $ tc filter add dev ens7 parent ffff: protocol ip pref 25 flower dst_ip 192.168.0.0/16 action drop
>>>>
>>>>
>>>> We will see the same output if we list filters for ens7 and ens8, including stats:
>>>>
>>>> $ tc -s filter show dev ens7 ingress
>>>> filter protocol ip pref 25 flower chain 0
>>>> filter protocol ip pref 25 flower chain 0 handle 0x1
>>>> eth_type ipv4
>>>> dst_ip 192.168.0.0/16
>>>> not_in_hw
>>>> action order 1: gact action drop
>>>> random type none pass val 0
>>>> index 1 ref 1 bind 1 installed 39 sec used 2 sec
>>>> Action statistics:
>>>> Sent 3108 bytes 37 pkt (dropped 37, overlimits 0 requeues 0)
>>>> backlog 0b 0p requeues 0
>>>>
>>>> $ tc -s filter show dev ens8 ingress
>>>> filter protocol ip pref 25 flower chain 0
>>>> filter protocol ip pref 25 flower chain 0 handle 0x1
>>>> eth_type ipv4
>>>> dst_ip 192.168.0.0/16
>>>> not_in_hw
>>>> action order 1: gact action drop
>>>> random type none pass val 0
>>>> index 1 ref 1 bind 1 installed 40 sec used 3 sec
>>>> Action statistics:
>>>> Sent 3108 bytes 37 pkt (dropped 37, overlimits 0 requeues 0)
>>>> backlog 0b 0p requeues 0
>>>
>>> This seems like really odd semantics to me ... a filter added to one
>>> device shows up on another.
>>
>> Why is it odd? They share the same block, so it is natural that rule
>> added to one shows in list of rules for all devices that share the same
>> block.
>>
>>
>>>
>>> Why not make the shared block a standalone object that is configured
>>> through its own set of commands and then referenced by both devices?
>>
>> I was thinking about that for a long time. That would require entirely
>> new set of netlink api and internal kernel handling just for this. Lots
>> of duplications. The reason is, the current API is strictly build around
>> ifindex. But the new API would not solve anything. As a user, I still
>> want so see shared rules in individial device listing, because they
>> would get processed for the device. So I believe that the proposed
>> behaviour is correct.
>>
>
>netconf has NETCONFA_IFINDEX_ALL to keep the device concept but to relay
>information that applies to more than 1 device. You could have something
>similar for tc and shared blocks. Admin is done on this device index
>(e.g., your shared block 22 becomes dev index -22) and the filters are
>attached to another device for sharing using the 'qdisc add' command above.
It can be extended like this I guess. But still, the original rule adding
has to work.
^ permalink raw reply
* RE: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member
From: Vivien Didelot @ 2017-10-13 14:26 UTC (permalink / raw)
To: David Laight, 'Florian Fainelli', netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
David S. Miller, Andrew Lunn
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD0094DFE@AcuExch.aculab.com>
Hi David,
David Laight <David.Laight@ACULAB.COM> writes:
> From: Florian Fainelli
>> Sent: 13 October 2017 00:05
> ...
>> How about using:
>>
>> union {
>> struct net_device *master;
>> struct net_device *slave;
>> } netdev;
> ...
>
> You can remove the 'netdev' all the compilers support unnamed unions.
There are issues with older GCC versions, see the commit 42275bd8fcb3
("switchdev: don't use anonymous union on switchdev attr/obj structs")
That's why I kept it in the v2 I sent.
Thanks,
Vivien
^ permalink raw reply
* Re: [PATCH net-next v2 1/1] bridge: return error code when deleting Vlan
From: David Ahern @ 2017-10-13 14:31 UTC (permalink / raw)
To: Nikolay Aleksandrov, Jamal Hadi Salim, Roman Mashak
Cc: David Miller, Stephen Hemminger, Linux Kernel Network Developers
In-Reply-To: <ba70b4c0-2bd9-9722-7101-e823d901f09f@cumulusnetworks.com>
On 10/12/17 8:15 PM, Nikolay Aleksandrov wrote:
> I do agree it's a bug, but there might be scripts that rely on it and
> don't check the return value when clearing vlans. They will end up with
> a partial clear and wrongly assumed state, so maybe leave the
> opportunistic delete but count if anything was actually deleted and send
> an event only then ?
+1
^ permalink raw reply
* [PATCH v2 0/5] adapt DPAA drivers for DSA
From: Madalin Bucur @ 2017-10-13 14:50 UTC (permalink / raw)
To: netdev, davem; +Cc: f.fainelli, andrew, vivien.didelot, junote, linux-kernel
Junote Cai reported that he was not able to get a DSA setup involving the
DPAA/FMAN driver to work and narrowed it down to of_find_net_device_by_node()
call in DSA setup. The initial attempt to fix this by adding of_node to the
platform device results in a second, failed, probing of the FMan MAC driver
against the new platform device created for the DPAA Ethernet driver.
Solve these issues by removing the of_node pointer from the platform device
and changing the net_dev dev to the of_device dev to ensure the DSA init
will be able to find the DPAA net_dev using of_find_net_device_by_node().
Several changes were required to enable this solution: refactoring the
adjust_link (also resulted in lesser, cleaner code) and renaming the fman
kernel modules to keep the legacy udev rules happy.
Changes in v2:
- fix issue on error path in "dpaa_eth: change device used" patch
- cleanup the dpaa_eth_probe() error paths
Madalin Bucur (5):
fsl/fman: remove of_node
dpaa_eth: move of_phy_connect() to the eth driver
dpaa_eth: change device used
dpaa_eth: cleanup dpaa_eth_probe() error paths
fsl/fman: add dpaa in module names
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 143 +++++++++++++------------
drivers/net/ethernet/freescale/fman/Makefile | 12 +--
drivers/net/ethernet/freescale/fman/mac.c | 135 ++++++-----------------
drivers/net/ethernet/freescale/fman/mac.h | 6 +-
4 files changed, 119 insertions(+), 177 deletions(-)
--
2.1.0
^ permalink raw reply
* [PATCH v2 1/5] fsl/fman: remove of_node
From: Madalin Bucur @ 2017-10-13 14:50 UTC (permalink / raw)
To: netdev, davem; +Cc: f.fainelli, andrew, vivien.didelot, junote, linux-kernel
In-Reply-To: <1507906212-10076-1-git-send-email-madalin.bucur@nxp.com>
The FMan MAC driver allocates a platform device for the Ethernet
driver to probe on. Setting pdev->dev.of_node with the MAC node
triggers the MAC driver probing of the new platform device. While
this fails quickly and does not affect the functionality of the
drivers, it is incorrect and must be removed. This was added to
address a report that DSA code using of_find_net_device_by_node()
is unable to use the DPAA interfaces. Error message seen before
this fix:
fsl_mac dpaa-ethernet.0: __devm_request_mem_region(mac) failed
fsl_mac: probe of dpaa-ethernet.0 failed with error -16
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/fman/mac.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 387eb4a..9a265f8 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -623,7 +623,6 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
goto no_mem;
}
- pdev->dev.of_node = node;
pdev->dev.parent = priv->dev;
set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
--
2.1.0
^ permalink raw reply related
* [PATCH v2 2/5] dpaa_eth: move of_phy_connect() to the eth driver
From: Madalin Bucur @ 2017-10-13 14:50 UTC (permalink / raw)
To: netdev, davem; +Cc: f.fainelli, andrew, vivien.didelot, junote, linux-kernel
In-Reply-To: <1507906212-10076-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 48 +++++++++++--
drivers/net/ethernet/freescale/fman/mac.c | 97 ++++++--------------------
drivers/net/ethernet/freescale/fman/mac.h | 5 +-
3 files changed, 66 insertions(+), 84 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 4225806..7cf61d6 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2435,6 +2435,48 @@ static void dpaa_eth_napi_disable(struct dpaa_priv *priv)
}
}
+static void dpaa_adjust_link(struct net_device *net_dev)
+{
+ struct mac_device *mac_dev;
+ struct dpaa_priv *priv;
+
+ priv = netdev_priv(net_dev);
+ mac_dev = priv->mac_dev;
+ mac_dev->adjust_link(mac_dev);
+}
+
+static int dpaa_phy_init(struct net_device *net_dev)
+{
+ struct mac_device *mac_dev;
+ struct phy_device *phy_dev;
+ struct dpaa_priv *priv;
+
+ priv = netdev_priv(net_dev);
+ mac_dev = priv->mac_dev;
+
+ phy_dev = of_phy_connect(net_dev, mac_dev->phy_node,
+ &dpaa_adjust_link, 0,
+ mac_dev->phy_if);
+ if (!phy_dev) {
+ netif_err(priv, ifup, net_dev, "init_phy() failed\n");
+ return -ENODEV;
+ }
+
+ /* Remove any features not supported by the controller */
+ phy_dev->supported &= mac_dev->if_support;
+
+ /* Enable the symmetric and asymmetric PAUSE frame advertisements,
+ * as most of the PHY drivers do not enable them by default.
+ */
+ phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
+ phy_dev->advertising = phy_dev->supported;
+
+ mac_dev->phy_dev = phy_dev;
+ net_dev->phydev = phy_dev;
+
+ return 0;
+}
+
static int dpaa_open(struct net_device *net_dev)
{
struct mac_device *mac_dev;
@@ -2445,12 +2487,8 @@ static int dpaa_open(struct net_device *net_dev)
mac_dev = priv->mac_dev;
dpaa_eth_napi_enable(priv);
- net_dev->phydev = mac_dev->init_phy(net_dev, priv->mac_dev);
- if (!net_dev->phydev) {
- netif_err(priv, ifup, net_dev, "init_phy() failed\n");
- err = -ENODEV;
+ if (dpaa_phy_init(net_dev))
goto phy_init_failed;
- }
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
err = fman_port_enable(mac_dev->port[i]);
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 9a265f8..a0a3107 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -57,9 +57,7 @@ struct mac_priv_s {
struct device *dev;
void __iomem *vaddr;
u8 cell_index;
- phy_interface_t phy_if;
struct fman *fman;
- struct device_node *phy_node;
struct device_node *internal_phy_node;
/* List of multicast addresses */
struct list_head mc_addr_list;
@@ -106,7 +104,7 @@ static void set_fman_mac_params(struct mac_device *mac_dev,
resource_size(mac_dev->res));
memcpy(¶ms->addr, mac_dev->addr, sizeof(mac_dev->addr));
params->max_speed = priv->max_speed;
- params->phy_if = priv->phy_if;
+ params->phy_if = mac_dev->phy_if;
params->basex_if = false;
params->mac_id = priv->cell_index;
params->fm = (void *)priv->fman;
@@ -419,15 +417,12 @@ void fman_get_pause_cfg(struct mac_device *mac_dev, bool *rx_pause,
}
EXPORT_SYMBOL(fman_get_pause_cfg);
-static void adjust_link_void(struct net_device *net_dev)
+static void adjust_link_void(struct mac_device *mac_dev)
{
}
-static void adjust_link_dtsec(struct net_device *net_dev)
+static void adjust_link_dtsec(struct mac_device *mac_dev)
{
- struct device *dev = net_dev->dev.parent;
- struct dpaa_eth_data *eth_data = dev->platform_data;
- struct mac_device *mac_dev = eth_data->mac_dev;
struct phy_device *phy_dev = mac_dev->phy_dev;
struct fman_mac *fman_mac;
bool rx_pause, tx_pause;
@@ -444,14 +439,12 @@ static void adjust_link_dtsec(struct net_device *net_dev)
fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
if (err < 0)
- netdev_err(net_dev, "fman_set_mac_active_pause() = %d\n", err);
+ dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
+ err);
}
-static void adjust_link_memac(struct net_device *net_dev)
+static void adjust_link_memac(struct mac_device *mac_dev)
{
- struct device *dev = net_dev->dev.parent;
- struct dpaa_eth_data *eth_data = dev->platform_data;
- struct mac_device *mac_dev = eth_data->mac_dev;
struct phy_device *phy_dev = mac_dev->phy_dev;
struct fman_mac *fman_mac;
bool rx_pause, tx_pause;
@@ -463,60 +456,12 @@ static void adjust_link_memac(struct net_device *net_dev)
fman_get_pause_cfg(mac_dev, &rx_pause, &tx_pause);
err = fman_set_mac_active_pause(mac_dev, rx_pause, tx_pause);
if (err < 0)
- netdev_err(net_dev, "fman_set_mac_active_pause() = %d\n", err);
-}
-
-/* Initializes driver's PHY state, and attaches to the PHY.
- * Returns 0 on success.
- */
-static struct phy_device *init_phy(struct net_device *net_dev,
- struct mac_device *mac_dev,
- void (*adj_lnk)(struct net_device *))
-{
- struct phy_device *phy_dev;
- struct mac_priv_s *priv = mac_dev->priv;
-
- phy_dev = of_phy_connect(net_dev, priv->phy_node, adj_lnk, 0,
- priv->phy_if);
- if (!phy_dev) {
- netdev_err(net_dev, "Could not connect to PHY\n");
- return NULL;
- }
-
- /* Remove any features not supported by the controller */
- phy_dev->supported &= mac_dev->if_support;
- /* Enable the symmetric and asymmetric PAUSE frame advertisements,
- * as most of the PHY drivers do not enable them by default.
- */
- phy_dev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
- phy_dev->advertising = phy_dev->supported;
-
- mac_dev->phy_dev = phy_dev;
-
- return phy_dev;
-}
-
-static struct phy_device *dtsec_init_phy(struct net_device *net_dev,
- struct mac_device *mac_dev)
-{
- return init_phy(net_dev, mac_dev, &adjust_link_dtsec);
-}
-
-static struct phy_device *tgec_init_phy(struct net_device *net_dev,
- struct mac_device *mac_dev)
-{
- return init_phy(net_dev, mac_dev, adjust_link_void);
-}
-
-static struct phy_device *memac_init_phy(struct net_device *net_dev,
- struct mac_device *mac_dev)
-{
- return init_phy(net_dev, mac_dev, &adjust_link_memac);
+ dev_err(mac_dev->priv->dev, "fman_set_mac_active_pause() = %d\n",
+ err);
}
static void setup_dtsec(struct mac_device *mac_dev)
{
- mac_dev->init_phy = dtsec_init_phy;
mac_dev->init = dtsec_initialization;
mac_dev->set_promisc = dtsec_set_promiscuous;
mac_dev->change_addr = dtsec_modify_mac_address;
@@ -528,14 +473,13 @@ static void setup_dtsec(struct mac_device *mac_dev)
mac_dev->set_multi = set_multi;
mac_dev->start = start;
mac_dev->stop = stop;
-
+ mac_dev->adjust_link = adjust_link_dtsec;
mac_dev->priv->enable = dtsec_enable;
mac_dev->priv->disable = dtsec_disable;
}
static void setup_tgec(struct mac_device *mac_dev)
{
- mac_dev->init_phy = tgec_init_phy;
mac_dev->init = tgec_initialization;
mac_dev->set_promisc = tgec_set_promiscuous;
mac_dev->change_addr = tgec_modify_mac_address;
@@ -547,14 +491,13 @@ static void setup_tgec(struct mac_device *mac_dev)
mac_dev->set_multi = set_multi;
mac_dev->start = start;
mac_dev->stop = stop;
-
+ mac_dev->adjust_link = adjust_link_void;
mac_dev->priv->enable = tgec_enable;
mac_dev->priv->disable = tgec_disable;
}
static void setup_memac(struct mac_device *mac_dev)
{
- mac_dev->init_phy = memac_init_phy;
mac_dev->init = memac_initialization;
mac_dev->set_promisc = memac_set_promiscuous;
mac_dev->change_addr = memac_modify_mac_address;
@@ -566,7 +509,7 @@ static void setup_memac(struct mac_device *mac_dev)
mac_dev->set_multi = set_multi;
mac_dev->start = start;
mac_dev->stop = stop;
-
+ mac_dev->adjust_link = adjust_link_memac;
mac_dev->priv->enable = memac_enable;
mac_dev->priv->disable = memac_disable;
}
@@ -850,13 +793,13 @@ static int mac_probe(struct platform_device *_of_dev)
mac_node);
phy_if = PHY_INTERFACE_MODE_SGMII;
}
- priv->phy_if = phy_if;
+ mac_dev->phy_if = phy_if;
- priv->speed = phy2speed[priv->phy_if];
+ priv->speed = phy2speed[mac_dev->phy_if];
priv->max_speed = priv->speed;
mac_dev->if_support = DTSEC_SUPPORTED;
/* We don't support half-duplex in SGMII mode */
- if (priv->phy_if == PHY_INTERFACE_MODE_SGMII)
+ if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII)
mac_dev->if_support &= ~(SUPPORTED_10baseT_Half |
SUPPORTED_100baseT_Half);
@@ -865,12 +808,12 @@ static int mac_probe(struct platform_device *_of_dev)
mac_dev->if_support |= SUPPORTED_1000baseT_Full;
/* The 10G interface only supports one mode */
- if (priv->phy_if == PHY_INTERFACE_MODE_XGMII)
+ if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII)
mac_dev->if_support = SUPPORTED_10000baseT_Full;
/* Get the rest of the PHY information */
- priv->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
- if (!priv->phy_node && of_phy_is_fixed_link(mac_node)) {
+ mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
+ if (!mac_dev->phy_node && of_phy_is_fixed_link(mac_node)) {
struct phy_device *phy;
err = of_phy_register_fixed_link(mac_node);
@@ -884,8 +827,8 @@ static int mac_probe(struct platform_device *_of_dev)
goto _return_dev_set_drvdata;
}
- priv->phy_node = of_node_get(mac_node);
- phy = of_phy_find_device(priv->phy_node);
+ mac_dev->phy_node = of_node_get(mac_node);
+ phy = of_phy_find_device(mac_dev->phy_node);
if (!phy) {
err = -EINVAL;
goto _return_dev_set_drvdata;
@@ -903,7 +846,7 @@ static int mac_probe(struct platform_device *_of_dev)
err = mac_dev->init(mac_dev);
if (err < 0) {
dev_err(dev, "mac_dev->init() = %d\n", err);
- of_node_put(priv->phy_node);
+ of_node_put(mac_dev->phy_node);
goto _return_dev_set_drvdata;
}
diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h
index d7313f0..1ca85a1 100644
--- a/drivers/net/ethernet/freescale/fman/mac.h
+++ b/drivers/net/ethernet/freescale/fman/mac.h
@@ -50,6 +50,8 @@ struct mac_device {
struct fman_port *port[2];
u32 if_support;
struct phy_device *phy_dev;
+ phy_interface_t phy_if;
+ struct device_node *phy_node;
bool autoneg_pause;
bool rx_pause_req;
@@ -58,11 +60,10 @@ struct mac_device {
bool tx_pause_active;
bool promisc;
- struct phy_device *(*init_phy)(struct net_device *net_dev,
- struct mac_device *mac_dev);
int (*init)(struct mac_device *mac_dev);
int (*start)(struct mac_device *mac_dev);
int (*stop)(struct mac_device *mac_dev);
+ void (*adjust_link)(struct mac_device *mac_dev);
int (*set_promisc)(struct fman_mac *mac_dev, bool enable);
int (*change_addr)(struct fman_mac *mac_dev, enet_addr_t *enet_addr);
int (*set_multi)(struct net_device *net_dev,
--
2.1.0
^ permalink raw reply related
* [PATCH v2 3/5] dpaa_eth: change device used
From: Madalin Bucur @ 2017-10-13 14:50 UTC (permalink / raw)
To: netdev, davem; +Cc: f.fainelli, andrew, vivien.didelot, junote, linux-kernel
In-Reply-To: <1507906212-10076-1-git-send-email-madalin.bucur@nxp.com>
Change device used for DMA mapping to the MAC device that is an
of_device, with proper DMA ops. Using this device for the netdevice
should also address the issue with DSA scenarios that need the
netdevice to be backed by an of_device.
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 42 ++++++++------------------
drivers/net/ethernet/freescale/fman/mac.c | 37 +++++++++--------------
drivers/net/ethernet/freescale/fman/mac.h | 1 -
3 files changed, 27 insertions(+), 53 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 7cf61d6..823aa65 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -385,34 +385,19 @@ static int dpaa_setup_tc(struct net_device *net_dev, enum tc_setup_type type,
static struct mac_device *dpaa_mac_dev_get(struct platform_device *pdev)
{
- struct platform_device *of_dev;
struct dpaa_eth_data *eth_data;
- struct device *dpaa_dev, *dev;
- struct device_node *mac_node;
+ struct device *dpaa_dev;
struct mac_device *mac_dev;
dpaa_dev = &pdev->dev;
eth_data = dpaa_dev->platform_data;
- if (!eth_data)
+ if (!eth_data) {
+ dev_err(dpaa_dev, "eth_data missing\n");
return ERR_PTR(-ENODEV);
-
- mac_node = eth_data->mac_node;
-
- of_dev = of_find_device_by_node(mac_node);
- if (!of_dev) {
- dev_err(dpaa_dev, "of_find_device_by_node(%pOF) failed\n",
- mac_node);
- of_node_put(mac_node);
- return ERR_PTR(-EINVAL);
}
- of_node_put(mac_node);
-
- dev = &of_dev->dev;
-
- mac_dev = dev_get_drvdata(dev);
+ mac_dev = eth_data->mac_dev;
if (!mac_dev) {
- dev_err(dpaa_dev, "dev_get_drvdata(%s) failed\n",
- dev_name(dev));
+ dev_err(dpaa_dev, "mac_dev missing\n");
return ERR_PTR(-EINVAL);
}
@@ -2696,7 +2681,13 @@ static int dpaa_eth_probe(struct platform_device *pdev)
int err = 0, i, channel;
struct device *dev;
- dev = &pdev->dev;
+ /* device used for DMA mapping */
+ dev = pdev->dev.parent;
+ err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
+ if (err) {
+ dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
+ return err;
+ }
/* Allocate this early, so we can store relevant information in
* the private area
@@ -2738,14 +2729,6 @@ static int dpaa_eth_probe(struct platform_device *pdev)
priv->buf_layout[RX].priv_data_size = DPAA_RX_PRIV_DATA_SIZE; /* Rx */
priv->buf_layout[TX].priv_data_size = DPAA_TX_PRIV_DATA_SIZE; /* Tx */
- /* device used for DMA mapping */
- set_dma_ops(dev, get_dma_ops(&pdev->dev));
- err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
- if (err) {
- dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
- goto dev_mask_failed;
- }
-
/* bp init */
for (i = 0; i < DPAA_BPS_NUM; i++) {
int err;
@@ -2879,7 +2862,6 @@ static int dpaa_eth_probe(struct platform_device *pdev)
dpaa_bps_free(priv);
bp_create_failed:
fq_probe_failed:
-dev_mask_failed:
mac_probe_failed:
dev_set_drvdata(dev, NULL);
free_netdev(net_dev);
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index a0a3107..1d6da1e 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -542,8 +542,7 @@ static const u16 phy2speed[] = {
};
static struct platform_device *dpaa_eth_add_device(int fman_id,
- struct mac_device *mac_dev,
- struct device_node *node)
+ struct mac_device *mac_dev)
{
struct platform_device *pdev;
struct dpaa_eth_data data;
@@ -556,10 +555,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
data.mac_dev = mac_dev;
data.mac_hw_id = priv->cell_index;
data.fman_hw_id = fman_id;
- data.mac_node = node;
mutex_lock(ð_lock);
-
pdev = platform_device_alloc("dpaa-ethernet", dpaa_eth_dev_cnt);
if (!pdev) {
ret = -ENOMEM;
@@ -648,9 +645,6 @@ static int mac_probe(struct platform_device *_of_dev)
goto _return;
}
- /* Register mac_dev */
- dev_set_drvdata(dev, mac_dev);
-
INIT_LIST_HEAD(&priv->mc_addr_list);
/* Get the FM node */
@@ -659,7 +653,7 @@ static int mac_probe(struct platform_device *_of_dev)
dev_err(dev, "of_get_parent(%pOF) failed\n",
mac_node);
err = -EINVAL;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
of_dev = of_find_device_by_node(dev_node);
@@ -693,7 +687,7 @@ static int mac_probe(struct platform_device *_of_dev)
if (err < 0) {
dev_err(dev, "of_address_to_resource(%pOF) = %d\n",
mac_node, err);
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
mac_dev->res = __devm_request_region(dev,
@@ -703,7 +697,7 @@ static int mac_probe(struct platform_device *_of_dev)
if (!mac_dev->res) {
dev_err(dev, "__devm_request_mem_region(mac) failed\n");
err = -EBUSY;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
priv->vaddr = devm_ioremap(dev, mac_dev->res->start,
@@ -711,7 +705,7 @@ static int mac_probe(struct platform_device *_of_dev)
if (!priv->vaddr) {
dev_err(dev, "devm_ioremap() failed\n");
err = -EIO;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
if (!of_device_is_available(mac_node)) {
@@ -728,7 +722,7 @@ static int mac_probe(struct platform_device *_of_dev)
if (err) {
dev_err(dev, "failed to read cell-index for %pOF\n", mac_node);
err = -EINVAL;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
priv->cell_index = (u8)val;
@@ -737,7 +731,7 @@ static int mac_probe(struct platform_device *_of_dev)
if (!mac_addr) {
dev_err(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
err = -EINVAL;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
memcpy(mac_dev->addr, mac_addr, sizeof(mac_dev->addr));
@@ -747,14 +741,14 @@ static int mac_probe(struct platform_device *_of_dev)
dev_err(dev, "of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n",
mac_node);
err = nph;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
if (nph != ARRAY_SIZE(mac_dev->port)) {
dev_err(dev, "Not supported number of fman-ports handles of mac node %pOF from device tree\n",
mac_node);
err = -EINVAL;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
for (i = 0; i < ARRAY_SIZE(mac_dev->port); i++) {
@@ -818,20 +812,20 @@ static int mac_probe(struct platform_device *_of_dev)
err = of_phy_register_fixed_link(mac_node);
if (err)
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
priv->fixed_link = kzalloc(sizeof(*priv->fixed_link),
GFP_KERNEL);
if (!priv->fixed_link) {
err = -ENOMEM;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
mac_dev->phy_node = of_node_get(mac_node);
phy = of_phy_find_device(mac_dev->phy_node);
if (!phy) {
err = -EINVAL;
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
priv->fixed_link->link = phy->link;
@@ -847,7 +841,7 @@ static int mac_probe(struct platform_device *_of_dev)
if (err < 0) {
dev_err(dev, "mac_dev->init() = %d\n", err);
of_node_put(mac_dev->phy_node);
- goto _return_dev_set_drvdata;
+ goto _return_of_get_parent;
}
/* pause frame autonegotiation enabled */
@@ -868,7 +862,7 @@ static int mac_probe(struct platform_device *_of_dev)
mac_dev->addr[0], mac_dev->addr[1], mac_dev->addr[2],
mac_dev->addr[3], mac_dev->addr[4], mac_dev->addr[5]);
- priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev, mac_node);
+ priv->eth_dev = dpaa_eth_add_device(fman_id, mac_dev);
if (IS_ERR(priv->eth_dev)) {
dev_err(dev, "failed to add Ethernet platform device for MAC %d\n",
priv->cell_index);
@@ -879,9 +873,8 @@ static int mac_probe(struct platform_device *_of_dev)
_return_of_node_put:
of_node_put(dev_node);
-_return_dev_set_drvdata:
+_return_of_get_parent:
kfree(priv->fixed_link);
- dev_set_drvdata(dev, NULL);
_return:
return err;
}
diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h
index 1ca85a1..eefb335 100644
--- a/drivers/net/ethernet/freescale/fman/mac.h
+++ b/drivers/net/ethernet/freescale/fman/mac.h
@@ -83,7 +83,6 @@ struct mac_device {
};
struct dpaa_eth_data {
- struct device_node *mac_node;
struct mac_device *mac_dev;
int mac_hw_id;
int fman_hw_id;
--
2.1.0
^ permalink raw reply related
* [PATCH v2 4/5] dpaa_eth: cleanup dpaa_eth_probe() error paths
From: Madalin Bucur @ 2017-10-13 14:50 UTC (permalink / raw)
To: netdev, davem; +Cc: f.fainelli, andrew, vivien.didelot, junote, linux-kernel
In-Reply-To: <1507906212-10076-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 53 ++++++++++----------------
1 file changed, 20 insertions(+), 33 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 823aa65..c6b97a1 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2695,7 +2695,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
net_dev = alloc_etherdev_mq(sizeof(*priv), DPAA_ETH_TXQ_NUM);
if (!net_dev) {
dev_err(dev, "alloc_etherdev_mq() failed\n");
- goto alloc_etherdev_mq_failed;
+ return -ENOMEM;
}
/* Do this here, so we can be verbose early */
@@ -2711,7 +2711,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
if (IS_ERR(mac_dev)) {
dev_err(dev, "dpaa_mac_dev_get() failed\n");
err = PTR_ERR(mac_dev);
- goto mac_probe_failed;
+ goto free_netdev;
}
/* If fsl_fm_max_frm is set to a higher value than the all-common 1500,
@@ -2735,7 +2735,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
dpaa_bps[i] = dpaa_bp_alloc(dev);
if (IS_ERR(dpaa_bps[i]))
- return PTR_ERR(dpaa_bps[i]);
+ goto free_dpaa_bps;
/* the raw size of the buffers used for reception */
dpaa_bps[i]->raw_size = bpool_buffer_raw_size(i, DPAA_BPS_NUM);
/* avoid runtime computations by keeping the usable size here */
@@ -2743,11 +2743,8 @@ static int dpaa_eth_probe(struct platform_device *pdev)
dpaa_bps[i]->dev = dev;
err = dpaa_bp_alloc_pool(dpaa_bps[i]);
- if (err < 0) {
- dpaa_bps_free(priv);
- priv->dpaa_bps[i] = NULL;
- goto bp_create_failed;
- }
+ if (err < 0)
+ goto free_dpaa_bps;
priv->dpaa_bps[i] = dpaa_bps[i];
}
@@ -2758,7 +2755,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
err = dpaa_alloc_all_fqs(dev, &priv->dpaa_fq_list, &port_fqs);
if (err < 0) {
dev_err(dev, "dpaa_alloc_all_fqs() failed\n");
- goto fq_probe_failed;
+ goto free_dpaa_bps;
}
priv->mac_dev = mac_dev;
@@ -2767,7 +2764,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
if (channel < 0) {
dev_err(dev, "dpaa_get_channel() failed\n");
err = channel;
- goto get_channel_failed;
+ goto free_dpaa_bps;
}
priv->channel = (u16)channel;
@@ -2787,20 +2784,20 @@ static int dpaa_eth_probe(struct platform_device *pdev)
err = dpaa_eth_cgr_init(priv);
if (err < 0) {
dev_err(dev, "Error initializing CGR\n");
- goto tx_cgr_init_failed;
+ goto free_dpaa_bps;
}
err = dpaa_ingress_cgr_init(priv);
if (err < 0) {
dev_err(dev, "Error initializing ingress CGR\n");
- goto rx_cgr_init_failed;
+ goto delete_egress_cgr;
}
/* Add the FQs to the interface, and make them active */
list_for_each_entry_safe(dpaa_fq, tmp, &priv->dpaa_fq_list, list) {
err = dpaa_fq_init(dpaa_fq, false);
if (err < 0)
- goto fq_alloc_failed;
+ goto free_dpaa_fqs;
}
priv->tx_headroom = dpaa_get_headroom(&priv->buf_layout[TX]);
@@ -2810,7 +2807,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
err = dpaa_eth_init_ports(mac_dev, dpaa_bps, DPAA_BPS_NUM, &port_fqs,
&priv->buf_layout[0], dev);
if (err)
- goto init_ports_failed;
+ goto free_dpaa_fqs;
/* Rx traffic distribution based on keygen hashing defaults to on */
priv->keygen_in_use = true;
@@ -2819,7 +2816,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
if (!priv->percpu_priv) {
dev_err(dev, "devm_alloc_percpu() failed\n");
err = -ENOMEM;
- goto alloc_percpu_failed;
+ goto free_dpaa_fqs;
}
for_each_possible_cpu(i) {
percpu_priv = per_cpu_ptr(priv->percpu_priv, i);
@@ -2832,11 +2829,11 @@ static int dpaa_eth_probe(struct platform_device *pdev)
/* Initialize NAPI */
err = dpaa_napi_add(net_dev);
if (err < 0)
- goto napi_add_failed;
+ goto delete_dpaa_napi;
err = dpaa_netdev_init(net_dev, &dpaa_ops, tx_timeout);
if (err < 0)
- goto netdev_init_failed;
+ goto delete_dpaa_napi;
dpaa_eth_sysfs_init(&net_dev->dev);
@@ -2845,31 +2842,21 @@ static int dpaa_eth_probe(struct platform_device *pdev)
return 0;
-netdev_init_failed:
-napi_add_failed:
+delete_dpaa_napi:
dpaa_napi_del(net_dev);
-alloc_percpu_failed:
-init_ports_failed:
+free_dpaa_fqs:
dpaa_fq_free(dev, &priv->dpaa_fq_list);
-fq_alloc_failed:
qman_delete_cgr_safe(&priv->ingress_cgr);
qman_release_cgrid(priv->ingress_cgr.cgrid);
-rx_cgr_init_failed:
+delete_egress_cgr:
qman_delete_cgr_safe(&priv->cgr_data.cgr);
qman_release_cgrid(priv->cgr_data.cgr.cgrid);
-tx_cgr_init_failed:
-get_channel_failed:
+free_dpaa_bps:
dpaa_bps_free(priv);
-bp_create_failed:
-fq_probe_failed:
-mac_probe_failed:
+free_netdev:
dev_set_drvdata(dev, NULL);
free_netdev(net_dev);
-alloc_etherdev_mq_failed:
- for (i = 0; i < DPAA_BPS_NUM && dpaa_bps[i]; i++) {
- if (atomic_read(&dpaa_bps[i]->refs) == 0)
- devm_kfree(dev, dpaa_bps[i]);
- }
+
return err;
}
--
2.1.0
^ permalink raw reply related
* [PATCH v2 5/5] fsl/fman: add dpaa in module names
From: Madalin Bucur @ 2017-10-13 14:50 UTC (permalink / raw)
To: netdev, davem; +Cc: f.fainelli, andrew, vivien.didelot, junote, linux-kernel
In-Reply-To: <1507906212-10076-1-git-send-email-madalin.bucur@nxp.com>
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
drivers/net/ethernet/freescale/fman/Makefile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile
index 2c38119..4ae524a 100644
--- a/drivers/net/ethernet/freescale/fman/Makefile
+++ b/drivers/net/ethernet/freescale/fman/Makefile
@@ -1,9 +1,9 @@
subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman
-obj-$(CONFIG_FSL_FMAN) += fsl_fman.o
-obj-$(CONFIG_FSL_FMAN) += fsl_fman_port.o
-obj-$(CONFIG_FSL_FMAN) += fsl_mac.o
+obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_fman.o
+obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_fman_port.o
+obj-$(CONFIG_FSL_FMAN) += fsl_dpaa_mac.o
-fsl_fman-objs := fman_muram.o fman.o fman_sp.o fman_keygen.o
-fsl_fman_port-objs := fman_port.o
-fsl_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o
+fsl_dpaa_fman-objs := fman_muram.o fman.o fman_sp.o fman_keygen.o
+fsl_dpaa_fman_port-objs := fman_port.o
+fsl_dpaa_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o
--
2.1.0
^ permalink raw reply related
* Fw: [Bug 197213] New: panic in interrupt after ioctl to tun
From: Stephen Hemminger @ 2017-10-13 15:11 UTC (permalink / raw)
To: netdev
Begin forwarded message:
Date: Thu, 12 Oct 2017 19:17:13 +0000
From: bugzilla-daemon@bugzilla.kernel.org
To: stephen@networkplumber.org
Subject: [Bug 197213] New: panic in interrupt after ioctl to tun
https://bugzilla.kernel.org/show_bug.cgi?id=197213
Bug ID: 197213
Summary: panic in interrupt after ioctl to tun
Product: Networking
Version: 2.5
Kernel Version: 4.14.0-rc4
Hardware: All
OS: Linux
Tree: Mainline
Status: NEW
Severity: normal
Priority: P1
Component: Other
Assignee: stephen@networkplumber.org
Reporter: avekceeb@gmail.com
Regression: No
Hi,
this is one more corner case found by syzkaller.
I'm not sure that 'Networking' is the right category for this, but the panic
was triggered by ioctl to /dev/net/tun...
[ 13.728009] BUG: unable to handle kernel NULL pointer dereference at
(null)
[ 13.728903] IP: run_timer_softirq+0x315/0x3f0
[ 13.729401] PGD 7bd8b067 P4D 7bd8b067 PUD 7bd7f067 PMD 0
[ 13.730040] Oops: 0002 [#1] SMP
[ 13.730400] Modules linked in:
[ 13.730747] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-rc4-with-tun #1
[ 13.731533] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.0.0-prebuilt.qemu-project.org 04/01/2014
[ 13.732672] task: ffffffffa280f480 task.stack: ffffffffa2800000
[ 13.733332] RIP: 0010:run_timer_softirq+0x315/0x3f0
[ 13.733883] RSP: 0018:ffff961b7fc03ed0 EFLAGS: 00010086
[ 13.734467] RAX: ffff961b7bf070c0 RBX: ffff961b7fc10cc0 RCX:
0000000000000000
[ 13.735265] RDX: dead000000000200 RSI: 00000000fffffe01 RDI:
ffff961b7fc10cc0
[ 13.736059] RBP: ffff961b7fc03f50 R08: 00000000fffba1c0 R09:
ffff961b7fc11168
[ 13.736857] R10: ffff961b7fc03ee8 R11: ffff961b7fc10d30 R12:
ffff961b7fc03ee0
[ 13.737652] R13: dead000000000200 R14: 0000000000000001 R15:
ffff961b7bf070c0
[ 13.738463] FS: 0000000000000000(0000) GS:ffff961b7fc00000(0000)
knlGS:0000000000000000
[ 13.739017] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 13.739339] CR2: 0000000000000000 CR3: 000000007bcf8000 CR4:
00000000000006f0
[ 13.739741] Call Trace:
[ 13.739882] <IRQ>
[ 13.740000] ? ktime_get+0x3b/0x90
[ 13.740196] ? lapic_next_event+0x18/0x20
[ 13.740413] __do_softirq+0xcf/0x2a8
[ 13.740606] irq_exit+0xab/0xb0
[ 13.740778] smp_apic_timer_interrupt+0x64/0x110
[ 13.741025] apic_timer_interrupt+0x90/0xa0
[ 13.741250] </IRQ>
[ 13.741367] RIP: 0010:default_idle+0x18/0xf0
[ 13.741596] RSP: 0018:ffffffffa2803e60 EFLAGS: 00000246 ORIG_RAX:
ffffffffffffff10
[ 13.741998] RAX: 0000000080000000 RBX: ffffffffa293f5e0 RCX:
0000000000000000
[ 13.742370] RDX: 0000000000000000 RSI: 0000000000000000 RDI:
0000000000000000
[ 13.742750] RBP: ffffffffa2803e78 R08: 000000040a453dcd R09:
ffff9c324031f930
[ 13.743128] R10: 0000000000000000 R11: 00000069d14f9aee R12:
0000000000000000
[ 13.743504] R13: 0000000000000000 R14: ffffffffa2a37780 R15:
0000000000000000
[ 13.743883] arch_cpu_idle+0xa/0x10
[ 13.744072] default_idle_call+0x1e/0x30
[ 13.744284] do_idle+0x14f/0x1a0
[ 13.744458] cpu_startup_entry+0x18/0x20
[ 13.744670] rest_init+0xa9/0xb0
[ 13.744845] start_kernel+0x3c6/0x3d3
[ 13.745043] x86_64_start_reservations+0x24/0x26
[ 13.745291] x86_64_start_kernel+0x6f/0x72
[ 13.745512] secondary_startup_64+0xa5/0xa5
[ 13.745741] Code: 88 4c 39 65 88 0f 84 3b ff ff ff 49 8b 04 24 48 85 c0 74
56 4d 8b 3c 24 4c 89 7b 08 0f 1f 44 00 00 49 8b 17 49 8b 4f 08 48 85 d2 <48> 89
11 74 04 48 89 4a 08 41 f6 47 2a 20 49 c7 47 08 00 00 00
[ 13.746745] RIP: run_timer_softirq+0x315/0x3f0 RSP: ffff961b7fc03ed0
[ 13.747087] CR2: 0000000000000000
[ 13.747270] ---[ end trace 04d492145975c7cc ]---
[ 13.747516] Kernel panic - not syncing: Fatal exception in interrupt
[ 13.747946] Kernel Offset: 0x20a00000 from 0xffffffff81000000 (relocation
range: 0xffffffff80000000-0xffffffffbfffffff)
[ 13.748515] ---[ end Kernel panic - not syncing: Fatal exception in
interrupt
Reproducer:
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
char addr[40] = {0xcf, 0x0b, 0x0b, 0x99, 0x22, 0x33, 0x96, 0xdf, 0xbd, 0x2e,
0x29, 0x1b, 0x4d, 0xc0, 0x2a, 0xee, 0x03};
void test() {
int fd = -1;
fd = open("/dev/net/tun", 0, 0);
syscall(__NR_ioctl, fd, 0x400454caul, addr);
}
#define max_iter 10
int main(void) {
int iter;
for (iter = 0; iter<max_iter; iter++) {
test();
printf("done %d of %d\n", iter+1, max_iter);
}
return 0;
}
Panic happens on variety of configs with CONFIG_TUN=y set from (at least) 4.12
to current stable (4.14-rc4)
virtual, bare metal - doesn't matter.
[ 164.060173]
==================================================================
[ 164.062769] BUG: KASAN: use-after-free in run_timer_softirq+0xd84/0x1000
[ 164.065030] Write of size 8 at addr ffff880065557148 by task swapper/0/0
[ 164.067264]
[ 164.067812] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.13.1-kcov-qemu-my #1
[ 164.070192] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
1.10.1-1ubuntu1 04/01/2014
[ 164.071510] Call Trace:
[ 164.071751] <IRQ>
[ 164.071959] dump_stack+0x83/0xb8
[ 164.072281] print_address_description+0x78/0x290
[ 164.072732] kasan_report+0x257/0x370
[ 164.073088] ? run_timer_softirq+0xd84/0x1000
[ 164.073508] __asan_report_store8_noabort+0x1c/0x20
[ 164.073977] run_timer_softirq+0xd84/0x1000
[ 164.074380] ? add_timer_on+0x630/0x630
[ 164.074757] ? native_apic_msr_write+0x2b/0x30
[ 164.075185] ? lapic_next_event+0x5f/0x90
[ 164.075573] ? clockevents_program_event+0x21d/0x2f0
[ 164.076049] ? tick_program_event+0x84/0xd0
[ 164.076453] __do_softirq+0x1c3/0x5a1
[ 164.076809] irq_exit+0x14e/0x180
[ 164.077132] smp_apic_timer_interrupt+0x7b/0xa0
[ 164.077567] apic_timer_interrupt+0x89/0x90
[ 164.077969] RIP: 0010:native_safe_halt+0x6/0x10
[ 164.078403] RSP: 0018:ffffffff83607d08 EFLAGS: 00000246 ORIG_RAX:
ffffffffffffff10
[ 164.079123] RAX: 0000000000000000 RBX: ffffffff83616d40 RCX:
0100000000000000
[ 164.079797] RDX: 1ffffffff06c2da8 RSI: 0000000000000000 RDI:
0000000000000000
[ 164.080472] RBP: ffffffff83607d08 R08: ffff88007ff3501c R09:
ffff88007ff35008
[ 164.081145] R10: ffff88007ff35018 R11: ffff88007ff35010 R12:
ffffffff83c5cba0
[ 164.081820] R13: ffffffff83616d40 R14: 0000000000000000 R15:
ffffffff83616d40
[ 164.082498] </IRQ>
[ 164.082719] ? next_zone+0x48/0x60
[ 164.083046] default_idle+0x22/0x230
[ 164.083390] arch_cpu_idle+0xf/0x20
[ 164.083725] default_idle_call+0x3b/0x60
[ 164.084101] do_idle+0x23e/0x310
[ 164.084413] cpu_startup_entry+0xcb/0xe0
[ 164.084789] ? cpu_in_idle+0x20/0x20
[ 164.085134] rest_init+0xe8/0xf0
[ 164.085447] start_kernel+0x6bc/0x6f1
[ 164.085784] ? thread_stack_cache_init+0x10/0x10
[ 164.086204] ? early_idt_handler_array+0x120/0x120
[ 164.086652] x86_64_start_reservations+0x2a/0x2c
[ 164.087003] x86_64_start_kernel+0x152/0x175
[ 164.087332] secondary_startup_64+0x9f/0x9f
[ 164.087647]
[ 164.087768] The buggy address belongs to the page:
[ 164.088139] page:ffffea00019555c0 count:0 mapcount:0 mapping:
(null) index:0x0
[ 164.088733] flags: 0xfffffc0000000()
[ 164.089008] raw: 000fffffc0000000 0000000000000000 0000000000000000
00000000ffffffff
[ 164.089582] raw: dead000000000100 dead000000000200 0000000000000000
0000000000000000
[ 164.090155] page dumped because: kasan: bad access detected
[ 164.090568]
[ 164.090707] Memory state around the buggy address:
[ 164.091066] ffff880065557000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff
[ 164.091598] ffff880065557080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff
[ 164.092131] >ffff880065557100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff
[ 164.092663] ^
[ 164.093077] ffff880065557180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff
[ 164.093608] ffff880065557200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff
[ 164.094139]
==================================================================
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply
* RE: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member
From: Vivien Didelot @ 2017-10-13 15:29 UTC (permalink / raw)
To: David Laight, 'Florian Fainelli', netdev@vger.kernel.org
Cc: Andrew Lunn, kernel@savoirfairelinux.com,
linux-kernel@vger.kernel.org, David S. Miller
In-Reply-To: <87y3ofi0oi.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
Hi again,
Vivien Didelot <vivien.didelot@savoirfairelinux.com> writes:
>>> How about using:
>>>
>>> union {
>>> struct net_device *master;
>>> struct net_device *slave;
>>> } netdev;
>> ...
>>
>> You can remove the 'netdev' all the compilers support unnamed unions.
>
> There are issues with older GCC versions, see the commit 42275bd8fcb3
> ("switchdev: don't use anonymous union on switchdev attr/obj structs")
>
> That's why I kept it in the v2 I sent.
At the same time, I can see that struct sk_buff uses anonym union a lot.
It seems weird that one raised a compiler issue for switchdev but not
for skbuff.h... Do you think it is viable to drop the name here then?
I'd be happy to respin a v3 if this sounds safe.
Thanks,
Vivien
^ permalink raw reply
* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
From: David Laight @ 2017-10-13 15:30 UTC (permalink / raw)
To: 'Vivien Didelot', netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,
David S. Miller, Florian Fainelli, Andrew Lunn
In-Reply-To: <20171013014113.29561-3-vivien.didelot@savoirfairelinux.com>
From: Vivien Didelot
> Sent: 13 October 2017 02:41
> As for mv88e6xxx, setup the switch from within the mv88e6060 driver with
> a random MAC address, and remove the .set_addr implementation.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> drivers/net/dsa/mv88e6060.c | 30 +++++++++++++++++++-----------
> 1 file changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> index 621cdc46ad81..2f9d5e6a0f97 100644
> --- a/drivers/net/dsa/mv88e6060.c
> +++ b/drivers/net/dsa/mv88e6060.c
...
> + REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) | addr[1]);
Is that supposed to be 9 ?
David
^ permalink raw reply
* Re: pull-request: wireless-drivers 2017-10-13
From: David Miller @ 2017-10-13 15:43 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <878tgfpl0l.fsf@kamboji.qca.qualcomm.com>
From: Kalle Valo <kvalo@codeaurora.org>
Date: Fri, 13 Oct 2017 10:25:14 +0300
> here's a pull request to net tree, more info in the signed tag below.
> Please let me know if there are any problems.
Pulled, thanks Kalle.
^ permalink raw reply
* [PATCH net-next] virtio_net: implement VIRTIO_CONFIG_S_NEEDS_RESET
From: Willem de Bruijn @ 2017-10-13 15:51 UTC (permalink / raw)
To: netdev; +Cc: davem, mst, jasowang, virtualization, Willem de Bruijn
From: Willem de Bruijn <willemb@google.com>
Implement the reset communication request defined in the VIRTIO 1.0
specification and introduces in Linux in commit c00bbcf862896 ("virtio:
add VIRTIO_CONFIG_S_NEEDS_RESET device status bit").
Use the virtnet_reset function introduced in commit 2de2f7f40ef9
("virtio_net: XDP support for adjust_head"). That was removed in
commit 4941d472bf95 ("virtio-net: do not reset during XDP set"),
because no longer used. Bring it back, minus the xdp specific code.
Before tearing down any state, virtnet_freeze_down quiesces the
device with netif_tx_disable. virtnet_reset also ensures that no
other config operations can run concurrently.
On successful reset, the host can observe that the flag has been
cleared. There is no need for the explicit control flag introduced
in the previous RFC of this patch.
Changes
RFC -> v1
- drop VIRTIO_NET_CTRL_RESET_ACK message
- drop VIRTIO_F_CAN_RESET flag to notify guest support
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
drivers/net/virtio_net.c | 48 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fc059f193e7d..8e768b54844f 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1903,13 +1903,14 @@ static const struct ethtool_ops virtnet_ethtool_ops = {
.set_link_ksettings = virtnet_set_link_ksettings,
};
-static void virtnet_freeze_down(struct virtio_device *vdev)
+static void virtnet_freeze_down(struct virtio_device *vdev, bool in_config)
{
struct virtnet_info *vi = vdev->priv;
int i;
- /* Make sure no work handler is accessing the device */
- flush_work(&vi->config_work);
+ /* Make sure no other work handler is accessing the device */
+ if (!in_config)
+ flush_work(&vi->config_work);
netif_device_detach(vi->dev);
netif_tx_disable(vi->dev);
@@ -1924,6 +1925,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev)
}
static int init_vqs(struct virtnet_info *vi);
+static void remove_vq_common(struct virtnet_info *vi);
static int virtnet_restore_up(struct virtio_device *vdev)
{
@@ -1952,6 +1954,40 @@ static int virtnet_restore_up(struct virtio_device *vdev)
return err;
}
+static int virtnet_reset(struct virtnet_info *vi)
+{
+ struct virtio_device *dev = vi->vdev;
+ int ret;
+
+ virtio_config_disable(dev);
+ dev->failed = dev->config->get_status(dev) & VIRTIO_CONFIG_S_FAILED;
+ virtnet_freeze_down(dev, true);
+ remove_vq_common(vi);
+
+ virtio_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
+ virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER);
+
+ ret = virtio_finalize_features(dev);
+ if (ret)
+ goto err;
+
+ ret = virtnet_restore_up(dev);
+ if (ret)
+ goto err;
+
+ ret = virtnet_set_queues(vi, vi->curr_queue_pairs);
+ if (ret)
+ goto err;
+
+ virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
+ virtio_config_enable(dev);
+ return 0;
+
+err:
+ virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
+ return ret;
+}
+
static int virtnet_set_guest_offloads(struct virtnet_info *vi, u64 offloads)
{
struct scatterlist sg;
@@ -2136,6 +2172,10 @@ static void virtnet_config_changed_work(struct work_struct *work)
virtnet_ack_link_announce(vi);
}
+ if (vi->vdev->config->get_status(vi->vdev) &
+ VIRTIO_CONFIG_S_NEEDS_RESET)
+ virtnet_reset(vi);
+
/* Ignore unknown (future) status bits */
v &= VIRTIO_NET_S_LINK_UP;
@@ -2756,7 +2796,7 @@ static __maybe_unused int virtnet_freeze(struct virtio_device *vdev)
struct virtnet_info *vi = vdev->priv;
virtnet_cpu_notif_remove(vi);
- virtnet_freeze_down(vdev);
+ virtnet_freeze_down(vdev, false);
remove_vq_common(vi);
return 0;
--
2.15.0.rc0.271.g36b669edcc-goog
^ permalink raw reply related
* Re: [net-next v2 00/18] tipc: Introduce Communcation Group feature
From: David Miller @ 2017-10-13 15:51 UTC (permalink / raw)
To: jon.maloy; +Cc: ying.xue, netdev, tipc-discussion
In-Reply-To: <1507885474-11213-1-git-send-email-jon.maloy@ericsson.com>
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Fri, 13 Oct 2017 11:04:16 +0200
> With this commit series we introduce a 'Group Communication' feature in
> order to resolve the datagram and multicast flow control problem. This
> new feature makes it possible for a user to instantiate multiple private
> virtual brokerless message buses by just creating and joining member
> sockets.
Series applied.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
^ permalink raw reply
* pull-request: mac80211-next 2017-10-13
From: Johannes Berg @ 2017-10-13 15:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-wireless
Hi Dave,
Sorry for the quick succession - there were a few issues with
the last pull request that only got noticed now, so I'm fixing
those here.
Please pull and let me know if there's any problem.
Thanks,
johannes
The following changes since commit 90a53e4432b12288316efaa5f308adafb8d304b0:
cfg80211: implement regdb signature checking (2017-10-11 14:24:24 +0200)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git tags/mac80211-next-for-davem-2017-10-13
for you to fetch changes up to b1b1ae2c1c150f8db5d3523c74e81eaf8cae5cbb:
mac80211: don't track HT capability changes (2017-10-13 14:29:02 +0200)
----------------------------------------------------------------
Three fixes for the recently added new code:
* make "make -s" silent for the certs file (Arnd)
* fix missing CONFIG_ in extra certs symbol (Arnd)
* use crypto_aead_authsize() to use the proper API
and two other changes:
* remove a set-but-unused variable
* don't track HT *capability* changes, capabilities
are supposed to be constant (HT operation changes)
----------------------------------------------------------------
Arnd Bergmann (2):
cfg80211: don't print log output for building shipped-certs
cfg80211: fix CFG80211_EXTRA_REGDB_KEYDIR typo
Johannes Berg (3):
mac80211: use crypto_aead_authsize()
cfg80211: remove set but never used variable cf_offset
mac80211: don't track HT capability changes
net/mac80211/aead_api.c | 4 ++--
net/mac80211/mlme.c | 14 +++-----------
net/wireless/Makefile | 4 ++--
net/wireless/chan.c | 4 +---
net/wireless/reg.c | 2 +-
5 files changed, 9 insertions(+), 19 deletions(-)
^ permalink raw reply
* RE: Kernel Performance Tuning for High Volume SCTP traffic
From: David Laight @ 2017-10-13 15:56 UTC (permalink / raw)
To: 'Traiano Welcome', linux-sctp@vger.kernel.org,
netdev@vger.kernel.org
In-Reply-To: <CAFKCRVL-e03Cn35-Vvtb8+NSAz3Tk2Hje_Hg5K9HfqgokEBPgg@mail.gmail.com>
From: Traiano Welcome
(copied to netdev)
> Sent: 13 October 2017 07:16
> To: linux-sctp@vger.kernel.org
> Subject: Kernel Performance Tuning for High Volume SCTP traffic
>
> Hi List
>
> I'm running a linux server processing high volumes of SCTP traffic and
> am seeing large numbers of packet overruns (ifconfig output).
I'd guess that overruns indicate that the ethernet MAC is failing to
copy the receive frames into kernel memory.
It is probably running out of receive buffers, but might be
suffering from a lack of bus bandwidth.
MAC drivers usually discard receive frames if they can't get
a replacement buffer - so you shouldn't run out of rx buffers.
This means the errors are probably below SCTP - so changing SCTP parameters
is unlikely to help.
I'd make sure any receive interrupt coalescing/mitigation is turned off.
David
> I think a large amount of performance tuning can probably be done to
> improve the linux kernel's SCTP handling performance, but there seem
> to be no guides on this available. Could anyone advise on this?
>
>
> Here are my current settings, and below, some stats:
>
>
> -----
> net.sctp.addip_enable = 0
> net.sctp.addip_noauth_enable = 0
> net.sctp.addr_scope_policy = 1
> net.sctp.association_max_retrans = 10
> net.sctp.auth_enable = 0
> net.sctp.cookie_hmac_alg = sha1
> net.sctp.cookie_preserve_enable = 1
> net.sctp.default_auto_asconf = 0
> net.sctp.hb_interval = 30000
> net.sctp.max_autoclose = 8589934
> net.sctp.max_burst = 40
> net.sctp.max_init_retransmits = 8
> net.sctp.path_max_retrans = 5
> net.sctp.pf_enable = 1
> net.sctp.pf_retrans = 0
> net.sctp.prsctp_enable = 1
> net.sctp.rcvbuf_policy = 0
> net.sctp.rto_alpha_exp_divisor = 3
> net.sctp.rto_beta_exp_divisor = 2
> net.sctp.rto_initial = 3000
> net.sctp.rto_max = 60000
> net.sctp.rto_min = 1000
> net.sctp.rwnd_update_shift = 4
> net.sctp.sack_timeout = 50
> net.sctp.sctp_mem = 61733040 82310730 123466080
> net.sctp.sctp_rmem = 40960 8655000 41943040
> net.sctp.sctp_wmem = 40960 8655000 41943040
> net.sctp.sndbuf_policy = 0
> net.sctp.valid_cookie_life = 60000
> -----
>
>
> I'm seeing a high rate of packet errors (almost all overruns) on both
> 10gb NICs attached to my linux server.
>
> The system is handling high volumes of network traffic, so this is
> likely a linux kernel tuning problem.
>
> All the normal tuning parameters I've tried thus far seems to be
> having little effect and I'm still seeing high volumes of packet
> overruns.
>
> Any pointers on other things I could try to get the system handling
> SCTP packets efficiently would be much appreciated!
>
> -----
> :~# ifconfig ens4f1
>
> ens4f1 Link encap:Ethernet HWaddr 5c:b9:01:de:0d:4c
> UP BROADCAST RUNNING PROMISC MULTICAST MTU:9000 Metric:1
> RX packets:22313514162 errors:17598241316 dropped:68
> overruns:17598241316 frame:0
> TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:31767480894219 (31.7 TB) TX bytes:0 (0.0 B)
> Interrupt:17 Memory:c9800000-c9ffffff
> -----
>
> System details:
>
> OS : Ubuntu Linux (4.11.0-14-generic #20~16.04.1-Ubuntu SMP x86_64 )
> CPU Cores : 72
> NIC Model : NetXtreme II BCM57810 10 Gigabit Ethernet
> RAM : 240 GiB
>
> NIC sample stats showing packet error rate:
>
> ----
>
> for i in `seq 1 10`;do echo "$i) `date`" - $(ifconfig ens4f0| egrep
> "RX"| egrep overruns;sleep 5);done
>
> 1) Thu Oct 12 19:50:40 SGT 2017 - RX packets:8364065830
> errors:2594507718 dropped:215 overruns:2594507718 frame:0
> 2) Thu Oct 12 19:50:45 SGT 2017 - RX packets:8365336060
> errors:2596662672 dropped:215 overruns:2596662672 frame:0
> 3) Thu Oct 12 19:50:50 SGT 2017 - RX packets:8366602087
> errors:2598840959 dropped:215 overruns:2598840959 frame:0
> 4) Thu Oct 12 19:50:55 SGT 2017 - RX packets:8367881271
> errors:2600989229 dropped:215 overruns:2600989229 frame:0
> 5) Thu Oct 12 19:51:01 SGT 2017 - RX packets:8369147536
> errors:2603157030 dropped:215 overruns:2603157030frame:0
> 6) Thu Oct 12 19:51:06 SGT 2017 - RX packets:8370149567
> errors:2604904183 dropped:215 overruns:2604904183frame:0
> 7) Thu Oct 12 19:51:11 SGT 2017 - RX packets:8371298018
> errors:2607183939 dropped:215 overruns:2607183939frame:0
> 8) Thu Oct 12 19:51:16 SGT 2017 - RX packets:8372455587
> errors:2609411186 dropped:215 overruns:2609411186frame:0
> 9) Thu Oct 12 19:51:21 SGT 2017 - RX packets:8373585102
> errors:2611680597 dropped:215 overruns:2611680597 frame:0
> 10) Thu Oct 12 19:51:26 SGT 2017 - RX packets:8374678508
> errors:2614053000 dropped:215 overruns:2614053000 frame:0
>
> ----
>
> However, checking (with tc) shows no ring buffer overruns on NIC:
>
> ----
>
> tc -s qdisc show dev ens4f0|egrep drop
>
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
> Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
>
> -----
>
> Checking tcp retransmits, the rate is low:
>
> -----
>
> for i in `seq 1 10`;do echo "`date`" - $(netstat -s | grep -i
> retransmited;sleep 2);done
>
> Thu Oct 12 20:04:29 SGT 2017 - 10633 segments retransmited
> Thu Oct 12 20:04:31 SGT 2017 - 10634 segments retransmited
> Thu Oct 12 20:04:33 SGT 2017 - 10636 segments retransmited
> Thu Oct 12 20:04:35 SGT 2017 - 10636 segments retransmited
> Thu Oct 12 20:04:37 SGT 2017 - 10638 segments retransmited
> Thu Oct 12 20:04:39 SGT 2017 - 10639 segments retransmited
> Thu Oct 12 20:04:41 SGT 2017 - 10640 segments retransmited
> Thu Oct 12 20:04:43 SGT 2017 - 10640 segments retransmited
> Thu Oct 12 20:04:45 SGT 2017 - 10643 segments retransmited
>
> ------
>
> What I've tried so far:
>
> - Tuning the NIC parameters (packet coalesce, offloading, upping NIC
> ring buffers etc ...):
>
> ethtool -L ens4f0 combined 30
> ethtool -K ens4f0 gso on rx on tx on sg on tso on
> ethtool -C ens4f0 rx-usecs 96
> ethtool -C ens4f0 adaptive-rx on
> ethtool -G ens4f0 rx 4078 tx 4078
>
> - sysctl tunables for the kernel (mainly increasing kernel tcp buffers):
>
> ---
>
> sysctl -w net.ipv4.tcp_low_latency=1
> sysctl -w net.ipv4.tcp_max_syn_backlog=16384
> sysctl -w net.core.optmem_max=20480000
> sysctl -w net.core.netdev_max_backlog=5000000
> sysctl -w net.ipv4.tcp_rmem="65536 1747600 83886080"
> sysctl -w net.core.somaxconn=1280
> sysctl -w kernel.sched_min_granularity_ns=10000000
> sysctl -w kernel.sched_wakeup_granularity_ns=15000000
> sysctl -w net.ipv4.tcp_wmem="65536 1747600 83886080"
> sysctl -w net.core.wmem_max=2147483647
> sysctl -w net.core.wmem_default=2147483647
> sysctl -w net.core.rmem_max=2147483647
> sysctl -w net.core.rmem_default=2147483647
> sysctl -w net.ipv4.tcp_congestion_control=cubic
> sysctl -w net.ipv4.tcp_rmem="163840 3495200 268754560"
> sysctl -w net.ipv4.tcp_wmem="163840 3495200 268754560"
> sysctl -w net.ipv4.udp_rmem_min="163840 3495200 268754560"
> sysctl -w net.ipv4.udp_wmem_min="163840 3495200 268754560"
> sysctl -w net.ipv4.tcp_mem="268754560 268754560 268754560"
> sysctl -w net.ipv4.udp_mem="268754560 268754560 268754560"
> sysctl -w net.ipv4.tcp_mtu_probing=1
> sysctl -w net.ipv4.tcp_slow_start_after_idle=0
>
>
> Results after this (apparently not much):
>
>
> ----
>
> :~# for i in `seq 1 10`;do echo "$i) `date`" - $(ifconfig ens4f1|
> egrep "RX"| egrep overruns;sleep 5);done
>
> 1) Thu Oct 12 20:42:56 SGT 2017 - RX packets:16260617113
> errors:10964865836 dropped:68 overruns:10964865836 frame:0
> 2) Thu Oct 12 20:43:01 SGT 2017 - RX packets:16263268608
> errors:10969589847 dropped:68 overruns:10969589847 frame:0
> 3) Thu Oct 12 20:43:06 SGT 2017 - RX packets:16265869693
> errors:10974489639 dropped:68 overruns:10974489639 frame:0
> 4) Thu Oct 12 20:43:11 SGT 2017 - RX packets:16268487078
> errors:10979323070 dropped:68 overruns:10979323070 frame:0
> 5) Thu Oct 12 20:43:16 SGT 2017 - RX packets:16271098501
> errors:10984193349 dropped:68 overruns:10984193349 frame:0
> 6) Thu Oct 12 20:43:21 SGT 2017 - RX packets:16273804004
> errors:10988857622 dropped:68 overruns:10988857622 frame:0
> 7) Thu Oct 12 20:43:26 SGT 2017 - RX packets:16276493470
> errors:10993340211 dropped:68 overruns:10993340211 frame:0
> 8) Thu Oct 12 20:43:31 SGT 2017 - RX packets:16278612090
> errors:10997152436 dropped:68 overruns:10997152436 frame:0
> 9) Thu Oct 12 20:43:36 SGT 2017 - RX packets:16281253727
> errors:11001834579 dropped:68 overruns:11001834579 frame:0
> 10) Thu Oct 12 20:43:41 SGT 2017 - RX packets:16283972622
> errors:11006374277 dropped:68 overruns:11006374277 frame:0
>
> ----
>
> Freak the CPU for better performance:
>
> cpufreq-set -r -g performance
>
> Results (nothing significant):
>
> ----
>
> :~# for i in `seq 1 10`;do echo "$i) `date`" - $(ifconfig ens4f1|
> egrep "RX"| egrep overruns;sleep 5);done
>
> 1) Thu Oct 12 21:53:07 SGT 2017 - RX packets:18506492788
> errors:14622639426 dropped:68 overruns:14622639426 frame:0
> 2) Thu Oct 12 21:53:12 SGT 2017 - RX packets:18509314581
> errors:14626750641 dropped:68 overruns:14626750641 frame:0
> 3) Thu Oct 12 21:53:17 SGT 2017 - RX packets:18511485458
> errors:14630268859 dropped:68 overruns:14630268859 frame:0
> 4) Thu Oct 12 21:53:22 SGT 2017 - RX packets:18514223562
> errors:14634547845 dropped:68 overruns:14634547845 frame:0
> 5) Thu Oct 12 21:53:27 SGT 2017 - RX packets:18516926578
> errors:14638745143 dropped:68 overruns:14638745143 frame:0
> 6) Thu Oct 12 21:53:32 SGT 2017 - RX packets:18519605412
> errors:14642929021 dropped:68 overruns:14642929021 frame:0
> 7) Thu Oct 12 21:53:37 SGT 2017 - RX packets:18522523560
> errors:14647108982 dropped:68 overruns:14647108982 frame:0
> 8) Thu Oct 12 21:53:42 SGT 2017 - RX packets:18525185869
> errors:14651577286 dropped:68 overruns:14651577286 frame:0
> 9) Thu Oct 12 21:53:47 SGT 2017 - RX packets:18527947266
> errors:14655961847 dropped:68 overruns:14655961847 frame:0
> 10) Thu Oct 12 21:53:52 SGT 2017 - RX packets:18530703288
> errors:14659988398 dropped:68 overruns:14659988398 frame:0
>
> ----
>
> Results using sar:
>
> ----
>
> :~# sar -n EDEV 5 3| egrep "(ens4f1|IFACE)"
>
> 11:17:43 PM IFACE rxerr/s txerr/s coll/s rxdrop/s
> txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s
> 11:17:48 PM ens4f1 360809.40 0.00 0.00 0.00
> 0.00 0.00 0.00 360809.40 0.00
> 11:17:53 PM ens4f1 382500.40 0.00 0.00 0.00
> 0.00 0.00 0.00 382500.40 0.00
> 11:17:58 PM ens4f1 353717.00 0.00 0.00 0.00
> 0.00 0.00 0.00 353717.00 0.00
> Average: ens4f1 365675.60 0.00 0.00 0.00
> 0.00 0.00 0.00 365675.60 0.00
>
> ----
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH net-next v2 1/1] bridge: return error code when deleting Vlan
From: Roman Mashak @ 2017-10-13 16:00 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: David Ahern, David Miller, Stephen Hemminger,
Linux Kernel Network Developers, Jamal Hadi Salim
In-Reply-To: <e4611694-4248-e796-5cca-24f3d07e0e9e@cumulusnetworks.com>
Nikolay Aleksandrov <nikolay@cumulusnetworks.com> writes:
[...]
>>> Why do you want to return the error code here? Walking the code paths
>>> seems like ENOENT or err from switchdev_port_obj_del are the 2 error
>>> possibilities.
>>
>> For example, if you attempt to delete a non-existing vlan on a port,
>> the current code succeeds and also sends event :
>>
>> rtnetlink_rcv_msg
>> rtnl_bridge_dellink
>> br_dellink
>> br_afspec
>> br_vlan_info
>>
>> int br_dellink(..)
>> {
>> ...
>> err = br_afspec()
>> if (err == 0)
>> br_ifinfo_notify(RTM_NEWLINK, p);
>> }
>>
>> This is misleading, so a proper errcode has to be produced.
>>
>
> True, but you also change the expected behaviour because now a user can
> clear all vlans with one request (1 - 4094), and after the change that
> will fail with a partial delete if some vlan was missing.
Nikolay, would you like to have a crack at fixing this?
> This has been the behaviour forever and some script might depend on it.
> Also IMO, and as David also mentioned, doing a partial delete is not good.
^ permalink raw reply
* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
From: Woojung.Huh @ 2017-10-13 16:02 UTC (permalink / raw)
To: David.Laight, vivien.didelot, netdev
Cc: linux-kernel, kernel, davem, f.fainelli, andrew
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD0094F25@AcuExch.aculab.com>
> From: Vivien Didelot
> > Sent: 13 October 2017 02:41
> > As for mv88e6xxx, setup the switch from within the mv88e6060 driver with
> > a random MAC address, and remove the .set_addr implementation.
> >
> > Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> > ---
> > drivers/net/dsa/mv88e6060.c | 30 +++++++++++++++++++-----------
> > 1 file changed, 19 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
> > index 621cdc46ad81..2f9d5e6a0f97 100644
> > --- a/drivers/net/dsa/mv88e6060.c
> > +++ b/drivers/net/dsa/mv88e6060.c
> ...
> > + REG_WRITE(REG_GLOBAL, GLOBAL_MAC_01, (addr[0] << 9) |
> addr[1]);
>
> Is that supposed to be 9 ?
Looks like it.
Check http://www.marvell.com/switching/assets/marvell_linkstreet_88E6060_datasheet.pdf
Woojung
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox