* Re: [PATCH] [net] liquidio: fix timespec64_to_ns typo
From: David Miller @ 2017-10-13 17:19 UTC (permalink / raw)
To: arnd
Cc: derek.chickles, satananda.burla, felix.manlunas, raghu.vatsavayi,
intiyaz.basha, ricardo.farrington, veerasenareddy.burru, netdev,
linux-kernel
In-Reply-To: <20171012094841.3178599-1-arnd@arndb.de>
From: Arnd Bergmann <arnd@arndb.de>
Date: Thu, 12 Oct 2017 11:48:31 +0200
> While experimenting with changes to the timekeeping code, I
> ran into a build error in the liquidio driver:
>
> drivers/net/ethernet/cavium/liquidio/lio_main.c: In function 'liquidio_ptp_settime':
> drivers/net/ethernet/cavium/liquidio/lio_main.c:1850:22: error: passing argument 1 of 'timespec_to_ns' from incompatible pointer type [-Werror=incompatible-pointer-types]
>
> The driver had a type mismatch since it was first merged, but
> this never caused problems because it is only built on 64-bit
> architectures that define timespec and timespec64 to the same
> type.
>
> If we ever want to compile-test the driver on 32-bit or change
> the way that 64-bit timespec64 is defined, we need to fix it,
> so let's just do it now.
>
> Fixes: f21fb3ed364b ("Add support of Cavium Liquidio ethernet adapters")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
^ permalink raw reply
* Re: [next-queue PATCH v7 4/6] net/sched: Introduce Credit Based Shaper (CBS) qdisc
From: Vinicius Costa Gomes @ 2017-10-13 17:12 UTC (permalink / raw)
To: Eric Dumazet
Cc: netdev, intel-wired-lan, jhs, xiyou.wangcong, jiri, andre.guedes,
ivan.briano, jesus.sanchez-palencia, boon.leong.ong,
richardcochran, henrik, levipearson, rodney.cummings
In-Reply-To: <1507862553.31614.53.camel@edumazet-glaptop3.roam.corp.google.com>
Hi,
Eric Dumazet <eric.dumazet@gmail.com> writes:
[...]
>
> Your mixing of s64 and u64 is disturbing.
>
> do_div() handles u64, not s64.
>
> div64_s64() might be needed in place of do_div()
I wasn't very comfortable about the signal juggling either. Didn't know
about div64_s64(), looks much better. Will fix, thanks.
Cheers,
^ permalink raw reply
* Re: [PATCH v1] pch_gbe: Switch to new PCI IRQ allocation API
From: Andy Shevchenko @ 2017-10-13 17:04 UTC (permalink / raw)
To: David S. Miller, netdev
In-Reply-To: <20171013170221.70056-1-andriy.shevchenko@linux.intel.com>
On Fri, 2017-10-13 at 20:02 +0300, Andy Shevchenko wrote:
> This removes custom flag handling.
Please, discard this one, slipped to early.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | 3 +-
> .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 42 +++++++++--
> -----------
> 2 files changed, 17 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
> b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
> index 8d710a3b4db0..697e29dd4bd3 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
> @@ -613,7 +613,6 @@ struct pch_gbe_privdata {
> * @rx_ring: Pointer of Rx descriptor ring structure
> * @rx_buffer_len: Receive buffer length
> * @tx_queue_len: Transmit queue length
> - * @have_msi: PCI MSI mode flag
> * @pch_gbe_privdata: PCI Device ID driver_data
> */
>
> @@ -623,6 +622,7 @@ struct pch_gbe_adapter {
> atomic_t irq_sem;
> struct net_device *netdev;
> struct pci_dev *pdev;
> + int irq;
> struct net_device *polling_netdev;
> struct napi_struct napi;
> struct pch_gbe_hw hw;
> @@ -637,7 +637,6 @@ struct pch_gbe_adapter {
> struct pch_gbe_rx_ring *rx_ring;
> unsigned long rx_buffer_len;
> unsigned long tx_queue_len;
> - bool have_msi;
> bool rx_stop_flag;
> int hwts_tx_en;
> int hwts_rx_en;
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> index 5ae9681a2da7..0284a3bc019c 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
> @@ -781,11 +781,8 @@ static void pch_gbe_free_irq(struct
> pch_gbe_adapter *adapter)
> {
> struct net_device *netdev = adapter->netdev;
>
> - free_irq(adapter->pdev->irq, netdev);
> - if (adapter->have_msi) {
> - pci_disable_msi(adapter->pdev);
> - netdev_dbg(netdev, "call pci_disable_msi\n");
> - }
> + free_irq(adapter->irq, netdev);
> + pci_free_irq_vectors(adapter->pdev);
> }
>
> /**
> @@ -799,7 +796,7 @@ static void pch_gbe_irq_disable(struct
> pch_gbe_adapter *adapter)
> atomic_inc(&adapter->irq_sem);
> iowrite32(0, &hw->reg->INT_EN);
> ioread32(&hw->reg->INT_ST);
> - synchronize_irq(adapter->pdev->irq);
> + synchronize_irq(adapter->irq);
>
> netdev_dbg(adapter->netdev, "INT_EN reg : 0x%08x\n",
> ioread32(&hw->reg->INT_EN));
> @@ -1903,30 +1900,23 @@ static int pch_gbe_request_irq(struct
> pch_gbe_adapter *adapter)
> {
> struct net_device *netdev = adapter->netdev;
> int err;
> - int flags;
>
> - flags = IRQF_SHARED;
> - adapter->have_msi = false;
> - err = pci_enable_msi(adapter->pdev);
> - netdev_dbg(netdev, "call pci_enable_msi\n");
> - if (err) {
> - netdev_dbg(netdev, "call pci_enable_msi - Error:
> %d\n", err);
> - } else {
> - flags = 0;
> - adapter->have_msi = true;
> - }
> - err = request_irq(adapter->pdev->irq, &pch_gbe_intr,
> - flags, netdev->name, netdev);
> + err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> + if (err < 0)
> + return err;
> +
> + adapter->irq = pci_irq_vector(pdev, 0);
> +
> + err = request_irq(adapter->irq, &pch_gbe_intr, IRQF_SHARED,
> + netdev->name, netdev);
> if (err)
> netdev_err(netdev, "Unable to allocate interrupt
> Error: %d\n",
> err);
> - netdev_dbg(netdev,
> - "adapter->have_msi : %d flags : 0x%04x return :
> 0x%04x\n",
> - adapter->have_msi, flags, err);
> + netdev_dbg(netdev, "have_msi : %d return : 0x%04x\n",
> + pci_dev_msi_enabled(adapter->pdev), err);
> return err;
> }
>
> -
> /**
> * pch_gbe_up - Up GbE network device
> * @adapter: Board private structure
> @@ -2399,9 +2389,9 @@ static void pch_gbe_netpoll(struct net_device
> *netdev)
> {
> struct pch_gbe_adapter *adapter = netdev_priv(netdev);
>
> - disable_irq(adapter->pdev->irq);
> - pch_gbe_intr(adapter->pdev->irq, netdev);
> - enable_irq(adapter->pdev->irq);
> + disable_irq(adapter->irq);
> + pch_gbe_intr(adapter->irq, netdev);
> + enable_irq(adapter->irq);
> }
> #endif
>
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
^ permalink raw reply
* [PATCH v1] pch_gbe: Switch to new PCI IRQ allocation API
From: Andy Shevchenko @ 2017-10-13 17:02 UTC (permalink / raw)
To: David S. Miller, netdev; +Cc: Andy Shevchenko
This removes custom flag handling.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | 3 +-
.../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 42 +++++++++-------------
2 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
index 8d710a3b4db0..697e29dd4bd3 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
@@ -613,7 +613,6 @@ struct pch_gbe_privdata {
* @rx_ring: Pointer of Rx descriptor ring structure
* @rx_buffer_len: Receive buffer length
* @tx_queue_len: Transmit queue length
- * @have_msi: PCI MSI mode flag
* @pch_gbe_privdata: PCI Device ID driver_data
*/
@@ -623,6 +622,7 @@ struct pch_gbe_adapter {
atomic_t irq_sem;
struct net_device *netdev;
struct pci_dev *pdev;
+ int irq;
struct net_device *polling_netdev;
struct napi_struct napi;
struct pch_gbe_hw hw;
@@ -637,7 +637,6 @@ struct pch_gbe_adapter {
struct pch_gbe_rx_ring *rx_ring;
unsigned long rx_buffer_len;
unsigned long tx_queue_len;
- bool have_msi;
bool rx_stop_flag;
int hwts_tx_en;
int hwts_rx_en;
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 5ae9681a2da7..0284a3bc019c 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -781,11 +781,8 @@ static void pch_gbe_free_irq(struct pch_gbe_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
- free_irq(adapter->pdev->irq, netdev);
- if (adapter->have_msi) {
- pci_disable_msi(adapter->pdev);
- netdev_dbg(netdev, "call pci_disable_msi\n");
- }
+ free_irq(adapter->irq, netdev);
+ pci_free_irq_vectors(adapter->pdev);
}
/**
@@ -799,7 +796,7 @@ static void pch_gbe_irq_disable(struct pch_gbe_adapter *adapter)
atomic_inc(&adapter->irq_sem);
iowrite32(0, &hw->reg->INT_EN);
ioread32(&hw->reg->INT_ST);
- synchronize_irq(adapter->pdev->irq);
+ synchronize_irq(adapter->irq);
netdev_dbg(adapter->netdev, "INT_EN reg : 0x%08x\n",
ioread32(&hw->reg->INT_EN));
@@ -1903,30 +1900,23 @@ static int pch_gbe_request_irq(struct pch_gbe_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
int err;
- int flags;
- flags = IRQF_SHARED;
- adapter->have_msi = false;
- err = pci_enable_msi(adapter->pdev);
- netdev_dbg(netdev, "call pci_enable_msi\n");
- if (err) {
- netdev_dbg(netdev, "call pci_enable_msi - Error: %d\n", err);
- } else {
- flags = 0;
- adapter->have_msi = true;
- }
- err = request_irq(adapter->pdev->irq, &pch_gbe_intr,
- flags, netdev->name, netdev);
+ err = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
+ if (err < 0)
+ return err;
+
+ adapter->irq = pci_irq_vector(pdev, 0);
+
+ err = request_irq(adapter->irq, &pch_gbe_intr, IRQF_SHARED,
+ netdev->name, netdev);
if (err)
netdev_err(netdev, "Unable to allocate interrupt Error: %d\n",
err);
- netdev_dbg(netdev,
- "adapter->have_msi : %d flags : 0x%04x return : 0x%04x\n",
- adapter->have_msi, flags, err);
+ netdev_dbg(netdev, "have_msi : %d return : 0x%04x\n",
+ pci_dev_msi_enabled(adapter->pdev), err);
return err;
}
-
/**
* pch_gbe_up - Up GbE network device
* @adapter: Board private structure
@@ -2399,9 +2389,9 @@ static void pch_gbe_netpoll(struct net_device *netdev)
{
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
- disable_irq(adapter->pdev->irq);
- pch_gbe_intr(adapter->pdev->irq, netdev);
- enable_irq(adapter->pdev->irq);
+ disable_irq(adapter->irq);
+ pch_gbe_intr(adapter->irq, netdev);
+ enable_irq(adapter->irq);
}
#endif
--
2.14.2
^ permalink raw reply related
* RE: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member
From: Vivien Didelot @ 2017-10-13 16:50 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: <063D6719AE5E284EB5DD2968C1650D6DD0094FEF@AcuExch.aculab.com>
Hi David,
David Laight <David.Laight@ACULAB.COM> writes:
> From: Vivien Didelot
>> Sent: 13 October 2017 16:29
>> 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 believe the problem is with initialisers for static structures
> that contain anonymous unions.
The dsa_port structures are dynamically allocated so this seems safe to
use an anonymous union here.
BTW v2 never left my computer in fact, so this will be fixed up in v2.
Thanks!
Vivien
^ permalink raw reply
* [RFC PATCH] net: realtek: r8169: implement set_link_ksettings()
From: Tobias Jakobi @ 2017-10-13 16:44 UTC (permalink / raw)
To: nic_swsd; +Cc: netdev, tremyfr, davem, Tobias Jakobi
Commit 6fa1ba61520576cf1346c4ff09a056f2950cb3bf partially
implemented the new ethtool API, by replacing get_settings()
with get_link_ksettings(). This breaks ethtool, since the
userspace tool (according to the new API specs) never tries
the legacy set() call, when the new get() call succeeds.
All attempts to chance some setting from userspace result in:
> Cannot set new settings: Operation not supported
Implement the missing set() call.
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
---
drivers/net/ethernet/realtek/r8169.c | 40 +++++++++++++++++++++---------------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index e03fcf914690..24e8f7133038 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -2025,21 +2025,6 @@ static int rtl8169_set_speed(struct net_device *dev,
return ret;
}
-static int rtl8169_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
- struct rtl8169_private *tp = netdev_priv(dev);
- int ret;
-
- del_timer_sync(&tp->timer);
-
- rtl_lock_work(tp);
- ret = rtl8169_set_speed(dev, cmd->autoneg, ethtool_cmd_speed(cmd),
- cmd->duplex, cmd->advertising);
- rtl_unlock_work(tp);
-
- return ret;
-}
-
static netdev_features_t rtl8169_fix_features(struct net_device *dev,
netdev_features_t features)
{
@@ -2166,6 +2151,29 @@ static int rtl8169_get_link_ksettings(struct net_device *dev,
return rc;
}
+static int rtl8169_set_link_ksettings(struct net_device *dev,
+ const struct ethtool_link_ksettings *cmd)
+{
+ struct rtl8169_private *tp = netdev_priv(dev);
+ int rc;
+ u32 advertising;
+
+ if (!ethtool_convert_link_mode_to_legacy_u32(&advertising,
+ cmd->link_modes.advertising))
+ return -EINVAL;
+
+ del_timer_sync(&tp->timer);
+
+ rtl_lock_work(tp);
+
+ rc = rtl8169_set_speed(dev, cmd->base.autoneg, cmd->base.speed,
+ cmd->base.duplex, advertising);
+
+ rtl_unlock_work(tp);
+
+ return rc;
+}
+
static void rtl8169_get_regs(struct net_device *dev, struct ethtool_regs *regs,
void *p)
{
@@ -2367,7 +2375,6 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
.get_drvinfo = rtl8169_get_drvinfo,
.get_regs_len = rtl8169_get_regs_len,
.get_link = ethtool_op_get_link,
- .set_settings = rtl8169_set_settings,
.get_msglevel = rtl8169_get_msglevel,
.set_msglevel = rtl8169_set_msglevel,
.get_regs = rtl8169_get_regs,
@@ -2379,6 +2386,7 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
.get_ts_info = ethtool_op_get_ts_info,
.nway_reset = rtl8169_nway_reset,
.get_link_ksettings = rtl8169_get_link_ksettings,
+ .set_link_ksettings = rtl8169_set_link_ksettings,
};
static void rtl8169_get_mac_version(struct rtl8169_private *tp,
--
2.13.5
^ permalink raw reply related
* RE: [PATCH net-next v2 2/4] net: dsa: mv88e6060: setup random mac address
From: Vivien Didelot @ 2017-10-13 16:44 UTC (permalink / raw)
To: Woojung.Huh, David.Laight, netdev
Cc: linux-kernel, kernel, davem, f.fainelli, andrew
In-Reply-To: <9235D6609DB808459E95D78E17F2E43D40B512EB@CHN-SV-EXMX02.mchp-main.com>
Hi David, Woojung,
Woojung.Huh@microchip.com writes:
>> 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
Hum, David is correct, there is a bug in the driver which needs to be
addressed first. MAC address bit 40 is addr[0] & 0x1, thus we must
shift byte 0 by 8 and mask it against 0xfe.
I'll respin this serie including a fix for both net and net-next.
Thanks,
Vivien
^ permalink raw reply
* Re: [PATCH net-next v2 1/2] dt-bindings: net: add DT bindings for Socionext UniPhier AVE
From: Masahiro Yamada @ 2017-10-13 16:41 UTC (permalink / raw)
To: Kunihiko Hayashi
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Andrew Lunn, Florian Fainelli,
Rob Herring, Mark Rutland, linux-arm-kernel,
Linux Kernel Mailing List, devicetree-u79uwXL29TY76Z2rM5mHXA,
Masami Hiramatsu, Jassi Brar
In-Reply-To: <1507854928-4357-2-git-send-email-hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
2017-10-13 9:35 GMT+09:00 Kunihiko Hayashi <hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>:
> DT bindings for the AVE ethernet controller found on Socionext's
> UniPhier platforms.
>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org>
> Signed-off-by: Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> .../bindings/net/socionext,uniphier-ave4.txt | 53 ++++++++++++++++++++++
> 1 file changed, 53 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/net/socionext,uniphier-ave4.txt
>
> diff --git a/Documentation/devicetree/bindings/net/socionext,uniphier-ave4.txt b/Documentation/devicetree/bindings/net/socionext,uniphier-ave4.txt
> new file mode 100644
> index 0000000..25f4d92
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/socionext,uniphier-ave4.txt
> @@ -0,0 +1,53 @@
> +* Socionext AVE ethernet controller
> +
> +This describes the devicetree bindings for AVE ethernet controller
> +implemented on Socionext UniPhier SoCs.
> +
> +Required properties:
> + - compatible: Should be
> + - "socionext,uniphier-pro4-ave4" : for Pro4 SoC
> + - "socionext,uniphier-pxs2-ave4" : for PXs2 SoC
> + - "socionext,uniphier-ld20-ave4" : for LD20 SoC
> + - "socionext,uniphier-ld11-ave4" : for LD11 SoC
Nit. LD11, LD20, in this order please.
> + - reg: Address where registers are mapped and size of region.
> + - interrupts: Should contain the MAC interrupt.
> + - phy-mode: See ethernet.txt in the same directory. Allow to choose
> + "rgmii", "rmii", or "mii" according to the PHY.
> + - pinctrl-names: List of assigned state names, see pinctrl
> + binding documentation.
> + - pinctrl-0: List of phandles to configure the GPIO pin,
configure the GPIO pin?
git-grep found this phrase.
$ git grep "List of phandles to configure the GPIO"
Documentation/devicetree/bindings/net/microchip,enc28j60.txt:-
pinctrl-0: List of phandles to configure the GPIO pin used as
interrupt line,
> + see pinctrl binding documentation. Choose this appropriately
> + according to phy-mode.
> + - <&pinctrl_ether_rgmii> if phy-mode is "rgmii".
> + - <&pinctrl_ether_rmii> if phy-mode is "rmii".
> + - <&pinctrl_ether_mii> if phy-mode is "mii".
pinctrl_ether_rgmii is just a label
you just happened to write in your DT file.
This information is totally unrelated to hardware specification.
It is not stable, either.
> + - phy-handle: Should point to the external phy device.
> + See ethernet.txt file in the same directory.
> + - mdio subnode: Should be device tree subnode with the following required
> + properties:
> + - #address-cells: Must be <1>.
> + - #size-cells: Must be <0>.
> + - reg: phy ID number, usually a small integer.
Are you talking about "Required subnode" in the "Required properties"?
> +Optional properties:
> + - local-mac-address: See ethernet.txt in the same directory.
> +
> +Example:
> +
> + ether: ethernet@65000000 {
> + compatible = "socionext,uniphier-ld20-ave4";
> + reg = <0x65000000 0x8500>;
> + interrupts = <0 66 4>;
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_ether_rgmii>;
> + phy-mode = "rgmii";
> + phy-handle = <ðphy>;
> + local-mac-address = [00 00 00 00 00 00];
> + mdio {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + ethphy: ethphy@1 {
> + reg = <1>;
> + };
> + };
> + };
> --
> 2.7.4
>
--
Best Regards
Masahiro Yamada
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: Kernel Performance Tuning for High Volume SCTP traffic
From: David Laight @ 2017-10-13 16:35 UTC (permalink / raw)
To: 'Traiano Welcome'
Cc: linux-sctp@vger.kernel.org, netdev@vger.kernel.org
In-Reply-To: <CAFKCRVLTA8Vrz-36rxfUtOf8Zc9mSPZteAgdyeETsqSa-XsOcQ@mail.gmail.com>
From: Traiano Welcome
> Sent: 13 October 2017 17:04
> On Fri, Oct 13, 2017 at 11:56 PM, David Laight <David.Laight@aculab.com> wrote:
> > 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.
>
> Does this mean that tuning UDP performance could help ? Or do you mean
> hardware (NIC) performance could be the issue?
I'd certainly check UDP performance.
David
^ permalink raw reply
* [PATCH][net-next] cxgb4: fix missing break in switch and indent return statements
From: Colin King @ 2017-10-13 16:29 UTC (permalink / raw)
To: Ganesh Goudar, netdev; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The break statement for the Macronix case is missing and will
fall through to the Winbond case and re-assign the size setting.
Fix this by adding the missing break statement. Also correctly
indent the return statements.
Detected by CoverityScan, CID#1458020 ("Missing break in switch")
Fixes: 96ac18f14a5a ("cxgb4: Add support for new flash parts")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index b3fd1f457639..fe7db70a9fa6 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -8289,7 +8289,7 @@ static int t4_get_flash_params(struct adapter *adap)
default:
dev_err(adap->pdev_dev, "Micron Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
- return -EINVAL;
+ return -EINVAL;
}
break;
}
@@ -8308,8 +8308,9 @@ static int t4_get_flash_params(struct adapter *adap)
default:
dev_err(adap->pdev_dev, "Macronix Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
- return -EINVAL;
+ return -EINVAL;
}
+ break;
}
case 0xef: { /* Winbond */
/* This Density -> Size decoding table is taken from Winbond
@@ -8326,7 +8327,7 @@ static int t4_get_flash_params(struct adapter *adap)
default:
dev_err(adap->pdev_dev, "Winbond Flash Part has bad size, ID = %#x, Density code = %#x\n",
flashid, density);
- return -EINVAL;
+ return -EINVAL;
}
break;
}
--
2.14.1
^ permalink raw reply related
* RE: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member
From: David Laight @ 2017-10-13 16:10 UTC (permalink / raw)
To: 'Vivien Didelot', 'Florian Fainelli',
netdev@vger.kernel.org
Cc: Andrew Lunn, kernel@savoirfairelinux.com,
linux-kernel@vger.kernel.org, David S. Miller
In-Reply-To: <874lr3vzg4.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me>
From: Vivien Didelot
> Sent: 13 October 2017 16:29
> 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 believe the problem is with initialisers for static structures
that contain anonymous unions.
David
^ permalink raw reply
* Re: Kernel Performance Tuning for High Volume SCTP traffic
From: Traiano Welcome @ 2017-10-13 16:03 UTC (permalink / raw)
To: David Laight; +Cc: linux-sctp@vger.kernel.org, netdev@vger.kernel.org
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD0094F48@AcuExch.aculab.com>
Hi David
On Fri, Oct 13, 2017 at 11:56 PM, David Laight <David.Laight@aculab.com> wrote:
> 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.
>
Does this mean that tuning UDP performance could help ? Or do you mean
hardware (NIC) performance could be the issue?
> I'd make sure any receive interrupt coalescing/mitigation is turned off.
>
I'll try that.
> 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 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
* 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: 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
* 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: [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
* [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: 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
* 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: [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
* 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
* [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
* [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 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
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