History log of /linux-master/drivers/staging/octeon/ethernet.c
Revision Date Author Comments
# 3db9eb6d 30-Oct-2023 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "staging: octeon: remove typedef in enum cvmx_helper_interface_mode_t"

This reverts commit a13f7e45823cd29af716ed6be1f53a344e0b9268.

The patch series that removed typedefs from the octeon driver was not
actually built properly, and broke the build (it's hard to test-build
this driver for some reason.) Remove them all at this point in time to
make sure the build works properly.

Link: https://lore.kernel.org/r/32e9ad3c-191e-4dd1-b1cc-07f7b93c3f28@roeck-us.net
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Oliver Crumrine <ozlinux@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c312b8b3 30-Oct-2023 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "staging: octeon: remove typedef in structs cvmx_pip_port_status_t and cvmx_pko_port_status_t"

This reverts commit b33a296d831189d8a8eedee360e889509b9c81e6.

The patch series that removed typedefs from the octeon driver was not
actually built properly, and broke the build (it's hard to test-build
this driver for some reason.) Remove them all at this point in time to
make sure the build works properly.

Link: https://lore.kernel.org/r/32e9ad3c-191e-4dd1-b1cc-07f7b93c3f28@roeck-us.net
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Oliver Crumrine <ozlinux@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b33a296d 28-Aug-2023 Oliver Crumrine <ozlinux@hotmail.com>

staging: octeon: remove typedef in structs cvmx_pip_port_status_t and cvmx_pko_port_status_t

Remove typedef in structs cvmx_pip_port_status_t and cvmx_pko_port_status_t,
and rename all instances to cvmx_pip_port_status, and cvmx_pko_port_status,
respectively

Signed-off-by: Oliver Crumrine <ozlinux@hotmail.com>
Link: https://lore.kernel.org/r/PH7PR11MB76434462A6563C5FBDEE51A8BCE0A@PH7PR11MB7643.namprd11.prod.outlook.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a13f7e45 28-Aug-2023 Oliver Crumrine <ozlinux@hotmail.com>

staging: octeon: remove typedef in enum cvmx_helper_interface_mode_t

Remove typedef in enum cvmx_helper_interface_mode_t, and rename all instances
to cvmx_helper_interface_mode

Signed-off-by: Oliver Crumrine <ozlinux@hotmail.com>
Link: https://lore.kernel.org/r/PH7PR11MB7643DEB4401AA83A0578087CBCE0A@PH7PR11MB7643.namprd11.prod.outlook.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c46d4073 03-Apr-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

staging: octeon: ethernet: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230403154014.2564054-23-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 524b09ea 19-Oct-2021 Jakub Kicinski <kuba@kernel.org>

staging: use eth_hw_addr_set() in orphan drivers

Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019171243.1412240-9-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8b6ce9b0 26-Oct-2021 Jakub Kicinski <kuba@kernel.org>

staging: use of_get_ethdev_address()

Use the new of_get_ethdev_address() helper for the cases
where dev->dev_addr is passed in directly as the destination.

@@
expression dev, np;
@@
- of_get_mac_address(np, dev->dev_addr)
+ of_get_ethdev_address(np, dev)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211026175038.3197397-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>


# a7605370 27-Jul-2021 Arnd Bergmann <arnd@arndb.de>

dev_ioctl: split out ndo_eth_ioctl

Most users of ndo_do_ioctl are ethernet drivers that implement
the MII commands SIOCGMIIPHY/SIOCGMIIREG/SIOCSMIIREG, or hardware
timestamping with SIOCSHWTSTAMP/SIOCGHWTSTAMP.

Separate these from the few drivers that use ndo_do_ioctl to
implement SIOCBOND, SIOCBR and SIOCWANDEV commands.

This is a purely cosmetic change intended to help readers find
their way through the implementation.

Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jay Vosburgh <j.vosburgh@gmail.com>
Cc: Veaceslav Falico <vfalico@gmail.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Vladimir Oltean <olteanv@gmail.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 83216e39 12-Apr-2021 Michael Walle <michael@walle.cc>

of: net: pass the dst buffer to of_get_mac_address()

of_get_mac_address() returns a "const void*" pointer to a MAC address.
Lately, support to fetch the MAC address by an NVMEM provider was added.
But this will only work with platform devices. It will not work with
PCI devices (e.g. of an integrated root complex) and esp. not with DSA
ports.

There is an of_* variant of the nvmem binding which works without
devices. The returned data of a nvmem_cell_read() has to be freed after
use. On the other hand the return of_get_mac_address() points to some
static data without a lifetime. The trick for now, was to allocate a
device resource managed buffer which is then returned. This will only
work if we have an actual device.

Change it, so that the caller of of_get_mac_address() has to supply a
buffer where the MAC address is written to. Unfortunately, this will
touch all drivers which use the of_get_mac_address().

Usually the code looks like:

const char *addr;
addr = of_get_mac_address(np);
if (!IS_ERR(addr))
ether_addr_copy(ndev->dev_addr, addr);

This can then be simply rewritten as:

of_get_mac_address(np, ndev->dev_addr);

Sometimes is_valid_ether_addr() is used to test the MAC address.
of_get_mac_address() already makes sure, it just returns a valid MAC
address. Thus we can just test its return code. But we have to be
careful if there are still other sources for the MAC address before the
of_get_mac_address(). In this case we have to keep the
is_valid_ether_addr() call.

The following coccinelle patch was used to convert common cases to the
new style. Afterwards, I've manually gone over the drivers and fixed the
return code variable: either used a new one or if one was already
available use that. Mansour Moufid, thanks for that coccinelle patch!

<spml>
@a@
identifier x;
expression y, z;
@@
- x = of_get_mac_address(y);
+ x = of_get_mac_address(y, z);
<...
- ether_addr_copy(z, x);
...>

@@
identifier a.x;
@@
- if (<+... x ...+>) {}

@@
identifier a.x;
@@
if (<+... x ...+>) {
...
}
- else {}

@@
identifier a.x;
expression e;
@@
- if (<+... x ...+>@e)
- {}
- else
+ if (!(e))
{...}

@@
expression x, y, z;
@@
- x = of_get_mac_address(y, z);
+ of_get_mac_address(y, z);
... when != x
</spml>

All drivers, except drivers/net/ethernet/aeroflex/greth.c, were
compile-time tested.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c295d300 20-Apr-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

staging: octeon: Use 'for_each_child_of_node'

Use 'for_each_child_of_node' instead of hand writing it.
This saves a few line of code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/eaffe388e6c51e97caf3e8fa474de74428575455.1618920182.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 179f5dc3 15-Oct-2020 Alexander Sverdlin <alexander.sverdlin@nokia.com>

staging: octeon: repair "fixed-link" support

The PHYs must be registered once in device probe function, not in device
open callback because it's only possible to register them once.

Fixes: a25e278020bf ("staging: octeon: support fixed-link phys")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201016101858.11374-1-alexander.sverdlin@nokia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 791e5f61 06-Jul-2020 Andrew Lunn <andrew@lunn.ch>

net: phy: mdio-octeon: Cleanup module loading dependencies

To ensure that the octeon MDIO driver has been loaded, the Cavium
ethernet drivers reference a dummy symbol in the MDIO driver. This
forces it to be loaded first. And this symbol has not been cleanly
implemented, resulting in warnings when build W=1 C=1.

Since device tree is being used, and a phandle points to the PHY on
the MDIO bus, we can make use of deferred probing. If the PHY fails to
connect, it should be because the MDIO bus driver has not loaded
yet. Return -EPROBE_DEFER so it will be tried again later.

Additionally, add a MODULE_SOFTDEP() to give user space a hint as to
what order it should load the modules.

v2:
s/octoen/octeon/
Add MODULE_SOFTDEP()

Cc: Sunil Goutham <sgoutham@marvell.com>
Cc: Robert Richter <rrichter@marvell.com>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 422d97b8 04-Feb-2020 Chris Packham <chris.packham@alliedtelesis.co.nz>

Revert "staging: octeon: delete driver"

This reverts commit 710d7fbe21ee2ceab121f1f84a20edf68f9f9742.
Re-instate the code so subsequent commits can clean it up and get it
building properly.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20200205001116.14096-3-chris.packham@alliedtelesis.co.nz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 710d7fbe 10-Dec-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: octeon: delete driver

This driver has been in the tree since 2009 with no real movement to get
it out. Now it is starting to cause build issues and other problems for
people who want to fix coding style problems, but can not actually build
it.

As nothing is happening here, just delete the module entirely.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Wambui Karuga <wambui.karugax@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Florian Westphal <fw@strlen.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Branden Bonaby <brandonbonaby94@gmail.com>
Cc: "Petr Štetiar" <ynezz@true.cz>
Cc: Sandro Volery <sandro@volery.com>
Cc: Paul Burton <paulburton@kernel.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Giovanni Gherdovich <bobdc9664@seznam.cz>
Cc: Valery Ivanov <ivalery111@gmail.com>
Link: https://lore.kernel.org/r/20191210091509.3546251-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 73aef0c9 12-Oct-2019 Wambui Karuga <wambui.karugax@gmail.com>

staging: octeon: remove typedef declaration for cvmx_helper_link_info

Remove declaration of union cvmx_helper_link_info as typedef.
Also replace its previous uses with new union declaration.
Issue found by checkpatch.pl

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/fb373aed8fd2b04d01198f5a5769fd2476714e88.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ef1fe6b7 12-Oct-2019 Wambui Karuga <wambui.karugax@gmail.com>

staging: octeon: remove typedef declaration for cvmx_wqe

Remove typedef declaration from struct cvmx_wqe.
Also replace its previous uses with new struct declaration.
Issue found by checkpatch.pl

Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Link: https://lore.kernel.org/r/fa82104ea8d7ff54dc66bfbfedb6cca541701991.1570821661.git.wambui.karugax@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 129dac37 11-Sep-2019 Sandro Volery <sandro@volery.com>

Staging: octeon: Avoid several usecases of strcpy

strcpy was used multiple times in strcpy to write into dev->name.
I replaced them with strscpy.

Signed-off-by: Sandro Volery <sandro@volery.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20190911062359.GA14886@volery
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 171a9bae 26-Jul-2019 Matthew Wilcox (Oracle) <willy@infradead.org>

staging/octeon: Allow test build on !MIPS

Add compile test support by moving all includes of files under
asm/octeon into octeon-ethernet.h, and if we're not on MIPS,
stub out all the calls into the octeon support code in octeon-stubs.h

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>


# da48be33 06-May-2019 Petr Štetiar <ynezz@true.cz>

staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check

Commit 284eb160681c ("staging: octeon-ethernet: support
of_get_mac_address new ERR_PTR error") has introduced checking for
ERR_PTR encoded error value from of_get_mac_address with IS_ERR macro,
which is not sufficient in this case, as the mac variable is set to NULL
initialy and if the kernel is compiled without DT support this NULL
would get passed to IS_ERR, which would lead to the wrong decision and
would pass that NULL pointer and invalid MAC address further.

Fixes: 284eb160681c ("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 284eb160 03-May-2019 Petr Štetiar <ynezz@true.cz>

staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error

There was NVMEM support added to of_get_mac_address, so it could now return
ERR_PTR encoded error values, so we need to adjust all current users of
of_get_mac_address to this new fact.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 9498da46d 25-Mar-2019 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: fix incorrect PHY mode

When connecting PHY, we set the mode to PHY_INTERFACE_MODE_GMII which is
not always correct. Specifically on boards where RGMII_RXID is needed
networking now longer works with at803x after commit 6d4cd041f0af
("net: phy: at803x: disable delay only for RGMII mode").

Fix by passing the correct mode. Tested on EdgeRouter Lite
(RGMII_RXID, at803x PHY) and D-Link DSR-500N (RGMII, broadcom PHY).

Fixes: 6d4cd041f0af ("net: phy: at803x: disable delay only for RGMII mode")
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7eb2a043 05-Dec-2018 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: delete redundant include

cvmx-smix-defs.h is not needed by this driver.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 732e6fc7 01-Nov-2018 Ioannis Valasakis <code@wizofe.uk>

staging: octeon: Fix style issues

Fix mismatch parentheses and style issues.
Reported by checkpatch.

Signed-off-by: Ioannis Valasakis <code@wizofe.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 98a95b9c 11-Jan-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: octeon: remove redundant license text

Now that the SPDX tag is in all drivers/staging/octeon/ files, that
identifies the license in a specific and legally-defined manner. So the
extra GPL text wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 30bdc499 11-Jan-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: octeon: add SPDX identifiers.

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Fix up the staging octeon driver to have a proper SPDX identifier, based
on the license text in the file itself. The SPDX identifier is a
legally binding shorthand, which can be used instead of the full boiler
plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 66812da3 15-Feb-2017 Tobias Klauser <tklauser@distanz.ch>

staging: octeon: Use net_device_stats from struct net_device

Instead of using a private copy of struct net_device_stats in
struct octeon_ethernet, use stats from struct net_device. Also remove
the now unnecessary .ndo_get_stats function.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8ad253fc 03-Feb-2017 Kamal Heib <kamalheib1@gmail.com>

staging: octeon: Fix line over 80 characters

This patch fix the line over 80 characters warning that was detected
using checkpatch.pl script.

Fixes: 6fe5efa1415c ('staging: octeon: Convert create_singlethread_workqueue()')
Cc: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e7c9a3d9 14-Dec-2016 Florian Fainelli <f.fainelli@gmail.com>

staging: octeon: Call SET_NETDEV_DEV()

The Octeon driver calls into PHYLIB which now checks for
net_device->dev.parent, so make sure we do set it before calling into
any MDIO/PHYLIB related function.

Fixes: ec988ad78ed6 ("phy: Don't increment MDIO bus refcount unless it's a different owner")
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: stable <stable@vger.kernel.org> # 4.9+
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 44770e11 17-Oct-2016 Jarod Wilson <jarod@redhat.com>

ethernet: use core min/max MTU checking

et131x: min_mtu 64, max_mtu 9216

altera_tse: min_mtu 64, max_mtu 1500

amd8111e: min_mtu 60, max_mtu 9000

bnad: min_mtu 46, max_mtu 9000

macb: min_mtu 68, max_mtu 1500 or 10240 depending on hardware capability

xgmac: min_mtu 46, max_mtu 9000

cxgb2: min_mtu 68, max_mtu 9582 (pm3393) or 9600 (vsc7326)

enic: min_mtu 68, max_mtu 9000

gianfar: min_mtu 50, max_mu 9586

hns_enet: min_mtu 68, max_mtu 9578 (v1) or 9706 (v2)

ksz884x: min_mtu 60, max_mtu 1894

myri10ge: min_mtu 68, max_mtu 9000

natsemi: min_mtu 64, max_mtu 2024

nfp: min_mtu 68, max_mtu hardware-specific

forcedeth: min_mtu 64, max_mtu 1500 or 9100, depending on hardware

pch_gbe: min_mtu 46, max_mtu 10300

pasemi_mac: min_mtu 64, max_mtu 9000

qcaspi: min_mtu 46, max_mtu 1500
- remove qcaspi_netdev_change_mtu as it is now redundant

rocker: min_mtu 68, max_mtu 9000

sxgbe: min_mtu 68, max_mtu 9000

stmmac: min_mtu 46, max_mtu depends on hardware

tehuti: min_mtu 60, max_mtu 16384
- driver had no max mtu checking, but product docs say 16k jumbo packets
are supported by the hardware

netcp: min_mtu 68, max_mtu 9486
- remove netcp_ndo_change_mtu as it is now redundant

via-velocity: min_mtu 64, max_mtu 9000

octeon: min_mtu 46, max_mtu 65370

CC: netdev@vger.kernel.org
CC: Mark Einon <mark.einon@gmail.com>
CC: Vince Bridgers <vbridger@opensource.altera.com>
CC: Rasesh Mody <rasesh.mody@qlogic.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Santosh Raspatur <santosh@chelsio.com>
CC: Hariprasad S <hariprasad@chelsio.com>
CC: Christian Benvenuti <benve@cisco.com>
CC: Sujith Sankar <ssujith@cisco.com>
CC: Govindarajulu Varadarajan <_govind@gmx.com>
CC: Neel Patel <neepatel@cisco.com>
CC: Claudiu Manoil <claudiu.manoil@freescale.com>
CC: Yisen Zhuang <yisen.zhuang@huawei.com>
CC: Salil Mehta <salil.mehta@huawei.com>
CC: Hyong-Youb Kim <hykim@myri.com>
CC: Jakub Kicinski <jakub.kicinski@netronome.com>
CC: Olof Johansson <olof@lixom.net>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Byungho An <bh74.an@samsung.com>
CC: Girish K S <ks.giri@samsung.com>
CC: Vipul Pandya <vipul.pandya@samsung.com>
CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
CC: Alexandre Torgue <alexandre.torgue@st.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Wingman Kwok <w-kwok2@ti.com>
CC: Murali Karicheri <m-karicheri2@ti.com>
CC: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 52edd01f 15-Sep-2016 Gargi Sharma <gs051095@gmail.com>

staging: octeon: remove multiple blank lines

Fixes the checkpatch issue Please don't use multiple blank lines.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f8b30859 13-Sep-2016 Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>

staging: octeon: use defines instead of magic numbers

The ugly magic number 65392 is waiting for CVMX_IPD_MAX_MTU
to appear in the mips tree.

Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 60dcf58a 02-Sep-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: stop using cvmx_helper_link_autoconf()

Stop using cvmx_helper_link_autoconf(). We want to remove it in the future,
as it duplicates link state information into platform code for no reason.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# aa652b1c 01-Sep-2016 Javier Martinez Canillas <javier@osg.samsung.com>

staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
built-in or as a module, use that macro instead of open coding the same.

Using the macro makes the code more readable by helping abstract away some
of the Kconfig built-in and module enable details.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ce060d8a 31-Aug-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: set up pknd for all interfaces

RX path uses pknd to find the correct device, and we maintain 1:1
port to pknd mapping. However, this is only set for XAUI interfaces
(in the arch code). But it should be set for all interface types.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5cf9b1ca 31-Aug-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: enable taking multiple rx groups into use

Enable taking multiple RX groups into use.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e971a119 31-Aug-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: support enabling multiple rx groups

Support enabling multiple RX groups.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 287faa5e 31-Aug-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: disable rx interrupts in oct_rx_shutdown

Disable RX interrupts in oct_rx_shutdown(). This way we don't need to
expose the RX IRQ numbers outside the RX module.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ef2d4f6c 30-Aug-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: configure rx-delay/tx-delay

Configure rx-delay/tx-delay when available.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5d99db13 15-Jul-2016 Philippe Reynes <tremyfr@gmail.com>

net: ethernet: octeon: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phydev in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0048a44c 29-Jun-2016 Aaro Koskinen <aaro.koskinen@nokia.com>

staging: octeon: delete redundant log message

There will be a separate banner message after pow0 is set up (or an
error message if it failed).

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0ad1ed99 29-Jun-2016 Aaro Koskinen <aaro.koskinen@nokia.com>

staging: octeon: validate interface before calling INDEX

Some helper functions call INDEX before checking if the interface is
valid. Since pow0 is not a real interface, we get the following errors:

cvmx_helper_get_interface_index_num: Illegal IPD port number

Fix by using INDEX only when needed with real interfaces.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 86bc5ed6 30-Jul-2016 Philippe Reynes <tremyfr@gmail.com>

net: ethernet: octeon: use phydev from struct net_device

The private structure contain a pointer to phydev, but the structure
net_device already contain such pointer. So we can remove the pointer
phydev in the private structure, and update the driver to use the
one contained in struct net_device.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ac05a587 12-Mar-2016 Laura Garcia Liebana <nevola@gmail.com>

staging: octeon: Fix alignment with open parenthesis

Alignment should match open parenthesis. Checkpatch detected these
issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0e350e17 27-Feb-2016 Laura Garcia Liebana <nevola@gmail.com>

staging: octeon: Insert blank line after struct declaration

Blank line is inserted after a struct declaration. Checkpatch detected
these issues.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7636941e 27-Feb-2016 Laura Garcia Liebana <nevola@gmail.com>

staging: octeon: Move logical operators on the correct line

Logical continuations should be on the previous line. Checkpatch detected this issue.

Signed-off-by: Laura Garcia Liebana <nevola@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6fe5efa1 27-Feb-2016 Bhaktipriya Shridhar <bhaktipriya96@gmail.com>

staging: octeon: Convert create_singlethread_workqueue()

With conccurency managed workqueues, use of dedicated workqueues can
be replaced by system_wq. Drop cvm_oct_poll_queue by using system_wq.

There are multiple work items per cvm_oct_poll_queue (viz.
cvm_oct_rx_refill_work, port_periodic_work) and different
cvm_oct_poll_queues need not be be ordered. Hence, concurrency
can be increased by switching to system_wq.

All work items are sync canceled in cvm_oct_remove() so it
is guaranteed that no work is in flight by the time exit path runs.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e26bf889 19-Feb-2016 Dilek Uzulmez <dilekuzulmez@gmail.com>

Staging: octeon: Remove blank lines after open braces

This patch fixes "blank lines aren't necessary after an open brace '{'"
checkpatch.pl warning in ethernet.c

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dcf24f77 19-Feb-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: drop atomic usage from rx counters

We have only one NAPI poll running at a time, so virtual port rx counters
can be updated normally.

Update of rx_dropped can still race with the gathering of statistics,
but full accuracy is not required there.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 710086db 11-Feb-2016 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon: refactor rgmii 10 mbps preamble error checking

Refactor RGMII 10 Mbps preamble error checking. The current implementation
does not work correctly in phydev mode since only the link status changes
trigger the callback, and if we stay on 10 Mbps operation the periodic
checks for error counters are never done.

Provide a periodic worker also during the phydev operation, and notify
the link status changes through the phydev instead of the inband
status change interrupt. This also has the benefit that we don't need
to use legacy CVMX MDIO calls to check the PHY state, and we can avoid
races that trigger bogus "Using 10Mbps with software preamble removal"
logs when interfaces are being bringed up. It also avoids some corner-case
crashes when the in-band interrupt triggers while the interface is
being taken down.

Tested on EdgeRouter Lite & D-Link DSR-1000N.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 192b6a84 19-Oct-2015 Muhammad Falak R Wani <falakreyaz@gmail.com>

staging: octeon: Remove explicit NULL comparison

Remove the explicit NULL comparison and rewrite in a compact form.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d566e690 17-Oct-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: move cvm_oct_xaui_open()

cvm_oct_xaui_open() is trivial and does not need a dedicated file.
Move it to the main file.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2c265f74 17-Oct-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: drop poll_now parameter from cvm_oct_common_open

Drop redundant poll_now parameter from cvm_oct_common_open.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 41cb5786 12-Oct-2015 Aaro Koskinen <aaro.koskinen@nokia.com>

staging: octeon-ethernet: xaui: use common init

Use common init.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 90590750 09-Oct-2015 Cristina Moraru <cristina.moraru09@gmail.com>

staging: octeon: Fix kernel-doc function description

Fix kernel-doc 'Excess function parameter' by moving
the description to the correct location. Also corrected
parameter description

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d0fbf9f3 09-Oct-2015 Cristina Moraru <cristina.moraru09@gmail.com>

staging: octeon: Remove /** from regular comments

Fix kernel-doc warnings 'cannot understand function prototype'
by removing /** from regular comments

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b775df29 09-Oct-2015 Cristina Moraru <cristina.moraru09@gmail.com>

staging: octeon: Remove extra line from kernel-doc

Fix 'bad line' kernel-doc warning

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ec2c398e 01-Oct-2015 Aybuke Ozdemir <aybuke.147@gmail.com>

Staging: octeon: Use preferred kernel type

This patch "uint*_t" type instead of "u*" type was used.
checkpatch.pl issue in octeon driver.

Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d5f9bc73 13-Aug-2015 Janne Huttunen <janne.huttunen@nokia.com>

STAGING: Octeon: Increase output command buffers

The Octeon II models have more interfaces and thus require more output
command buffers. Increase the allocation to support these models.

Signed-off-by: Janne Huttunen <janne.huttunen@nokia.com>
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Acked-by: David Daney <david.daney@cavium.com>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Janne Huttunen <janne.huttunen@nokia.com>
Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Patchwork: https://patchwork.linux-mips.org/patch/10965/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# bcbb1396 13-Aug-2015 Aaro Koskinen <aaro.koskinen@nokia.com>

STAGING: Octeon: Properly enable/disable SSO WQE interrupts

The Octeon models with SSO instead of POW need to use a different register
for configuring the WQE interrupt thresholds.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Acked-by: David Daney <david.daney@cavium.com>
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Janne Huttunen <janne.huttunen@nokia.com>
Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Patchwork: https://patchwork.linux-mips.org/patch/10964/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 4bc8ff74 25-Jul-2015 Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>

staging: octeon: add missing blank line after declarations

Fixes checkpatch.pl
WARNING: Missing a blank line after delarations

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 67620987 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: update boilerplate comments

Update boilerplate comments to be more terse by removing
redundant information.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 948c251b 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: eliminate OCTEON_ETHERNET_VERSION

This driver has drifted away from out-of-tree versions years ago
and the version string does not provide any useful information.
Instead provide the kernel version string to ethtool, so that we get
useful version information e.g. for bug reports.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c93b0e75 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: eliminate DONT_WRITEBACK

This feature is not used so eliminate it.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cccdb277 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: eliminate USE_RED define

We have RED always enabled, so eliminate the #define.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6646baf7 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: eliminate USE_HW_TCPUDP_CHECKSUM define

HW checksum is always enabled, so delete a redundant define.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a8d2e817 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: sgmii/xaui: make link poll generic

Make link poll generic to avoid copy paste.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c339145 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: delete sgmii and xaui specific uninit functions

Delete redundant wrappers.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# be76400c 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: move ndo_stop to common init

All init functions call ndo_stop if it's defined, so move it
to common function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 96217ebf 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: consolidate ndo_stop functions

All ndo_stop functions are identical. Get rid of duplicated code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9e3ae4f9 04-Apr-2015 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: consolidate ndo_open functions

ndo_open for rgmii, sgmii and xaui are almost identical. Put the common
code in a single function.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8a5cc923 30-Mar-2015 Paul Martin <paul.martin@codethink.co.uk>

MIPS: Octeon: Set up ethernet hardware for little endian

Signed-off-by: Paul Martin <paul.martin@codethink.co.uk>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9635/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 0270c625 25-Mar-2015 Helen Fornazier <helen.fornazier@gmail.com>

Staging: octeon: Remove extern from .c file

This patch fixes the checkpatch.pl warning:

WARNING: externs should be avoided in .c files
+extern void octeon_mdiobus_force_mod_depencency(void);

Signed-off-by: Helen Fornazier <helen.fornazier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 87794575 16-Mar-2015 Fabian Frederick <fabf@skynet.be>

Staging: octeon: constify of_device_id array

of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f5801a81 11-Jan-2015 Gustavo A. R. Silva <silvagustavosilva@gmail.com>

Staging: octeon: Fixed a typo

Fixed a typo in ethernet.c file.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 030739f5 07-Nov-2014 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: drop multiple NAPI instances

Octeon Ethernet driver is currently trying to wake up multiple
CPU cores for parallel NAPI processing when needed, to cope
with the fact that all network interfaces are handled through
the same receive queue processed by a single core/interrupt
(see http://marc.info/?l=linux-kernel&m=137209784914565&w=2).

This partially overlaps with generic RPS functionality.
Commit a6a39a7fcff5 ("staging: octeon-ethernet: disable load balance
for receiving packet when CONFIG_RPS is enabled") already disabled this
when RPS is enabled. Let's delete this code altogether as it has issues
like packet reordering and potential problems with CPU offlining/onlining.

Tested on EdgeRouter Lite.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-By: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a4652e8e 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

staging: octeon: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 6c71ea54 07-Oct-2014 Dilek Uzulmez <dilekuzulmez@gmail.com>

staging: octeon: Fix warning of prefer ether_addr_copy.

This patch fixes the following checkpatch.pl warnings:
WARNING: "Prefer ether_addr_copy() over memcpy() if the Ethernet
addresses are __aligned(2)" in file ethernet.c
Pahole shows that the addresses are aligned.

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 99f8dbc5 27-Sep-2014 Esra Altintas <es.altintas@gmail.com>

staging: octeon: Fix line 80 characters in ethernet.c

The following patch fixes the checpatch.pl warning:
WARNING: line over 80 characters

Signed-off-by: Esra Altintas <es.altintas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0a5fcc6b 20-Sep-2014 Gulsah Kose <gulsah.1004@gmail.com>

staging: octeon: Fix quoted string split warning.

This patch fixes "quoted string split across lines" checkpatch.pl
warning in ethernet.c

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 39bc7513 20-Sep-2014 Gulsah Kose <gulsah.1004@gmail.com>

staging: octeon: Fix missing blank line warning.

Fixes "Missing a blank line after declarations" checkpatch.pl warning in
ethernet.c

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ec3a2207 29-May-2014 David Daney <david.daney@cavium.com>

staging: octeon-ethernet: Move PHY activation to .ndo_open().

This prevents PHY not found types of errors for PHY drivers that are
probed after the Ethernet driver is probed, because the ifconfig UP is
done from userspace after all drivers have been probed.

Also avoid the cvmx-helper-board.c PHY code if a real PHY driver is
present, this allows a bootloader supplied device tree to specify the
PHY information rather than having to modify the code for each
different board.

Tested-by: Alex Smith <alex.smith@imgtec.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7ad24ea4 10-May-2014 Wilfried Klaebe <w-lkml@lebenslange-mailadresse.de>

net: get rid of SET_ETHTOOL_OPS

net: get rid of SET_ETHTOOL_OPS

Dave Miller mentioned he'd like to see SET_ETHTOOL_OPS gone.
This does that.

Mostly done via coccinelle script:
@@
struct ethtool_ops *ops;
struct net_device *dev;
@@
- SET_ETHTOOL_OPS(dev, ops);
+ dev->ethtool_ops = ops;

Compile tested only, but I'd seriously wonder if this broke anything.

Suggested-by: Dave Miller <davem@davemloft.net>
Signed-off-by: Wilfried Klaebe <w-lkml@lebenslange-mailadresse.de>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 90419615 01-Mar-2014 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: make num_packet_buffers static

Make num_packet_buffers static to eliminate a sparse warning.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5ff8bebb 01-Mar-2014 Aaro Koskinen <aaro.koskinen@iki.fi>

staging: octeon-ethernet: drop CONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS

We don't have such Kconfig option, so the current code is dead and
the documentation is wrong. Users can adjust this setting by using
module parameter or kernel command line, so we can delete this code.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 885a947e 10-Dec-2013 Paul Gortmaker <paul.gortmaker@windriver.com>

staging: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4d978452 28-Oct-2013 Luka Perkov <luka@openwrt.org>

staging: octeon: drop redundant mac address check

Checking if MAC address is valid using is_valid_ether_addr() is already done in
of_get_mac_address().

Signed-off-by: Luka Perkov <luka@openwrt.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 851ec8cd 13-Oct-2013 Nandini Hanumanthagowda <nandu.hgowda@gmail.com>

staging: octeon: Removed space at start of line

Removed unnecessary space at start of line
to fix checkpatch.pl warning.

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b186410d 13-Oct-2013 Nandini Hanumanthagowda <nandu.hgowda@gmail.com>

staging: octeon: Fixed line over 80 chars warning

Fixed the line over 80 characters warning
to comply with linux cidung style

Signed-off-by: Nandini Hanumanthagowda <nandu.hgowda@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 15c6ff3b 31-Dec-2012 Jiri Pirko <jiri@resnulli.us>

net: remove unnecessary NET_ADDR_RANDOM "bitclean"

NET_ADDR_SET is set in dev_set_mac_address() no need to alter
dev->addr_assign_type value in drivers.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d82603c6 27-Dec-2012 Jorrit Schippers <jorrit@ncode.nl>

treewide: Replace incomming with incoming in all comments and strings

Signed-off-by: Jorrit Schippers <jorrit@ncode.nl>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# f7e2f350 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

staging: octeon: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4f240906 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

staging: octeon: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 095d0bb5 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

staging: octeon_ethernet: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# df9244c5 05-Jul-2012 David Daney <david.daney@cavium.com>

staging: octeon_ethernet: Convert to use device tree.

Get MAC address and PHY connection from the device tree. The driver
is converted to a platform driver.

Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-mips@linux-mips.org
Cc: devicetree-discuss@lists.ozlabs.org
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/3940/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# dc890df0 18-Apr-2012 Imre Kaloz <kaloz@openwrt.org>

staging: octeon-ethernet: fix build errors by including interrupt.h

This patch fixes the following build failures:

drivers/staging/octeon/ethernet.c: In function 'cvm_oct_cleanup_module':
drivers/staging/octeon/ethernet.c:799:2: error: implicit declaration of function 'free_irq'
drivers/staging/octeon/ethernet-rx.c: In function 'cvm_oct_no_more_work':
drivers/staging/octeon/ethernet-rx.c:119:3: error: implicit declaration of function 'enable_irq'
drivers/staging/octeon/ethernet-rx.c: In function 'cvm_oct_do_interrupt':
drivers/staging/octeon/ethernet-rx.c:136:2: error: implicit declaration of function 'disable_irq_nosync'
drivers/staging/octeon/ethernet-rx.c: In function 'cvm_oct_rx_initialize':
drivers/staging/octeon/ethernet-rx.c:532:2: error: implicit declaration of function 'request_irq'
drivers/staging/octeon/ethernet-tx.c: In function 'cvm_oct_tx_initialize':
drivers/staging/octeon/ethernet-tx.c:712:2: error: implicit declaration of function 'request_irq'
drivers/staging/octeon/ethernet-tx.c: In function 'cvm_oct_tx_shutdown':
drivers/staging/octeon/ethernet-tx.c:723:2: error: implicit declaration of function 'free_irq'

Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 215c47c9 26-Mar-2012 Justin P. Mattock <justinmattock@gmail.com>

staging:octeon Fix typos in staging:octeon

The below patch is a resend to fix some typos and comments that
I have found while reading.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Acked-by: David Daney <david.daney@cavium.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# af866496 22-Nov-2011 David Daney <david.daney@cavium.com>

MIPS: Octeon: Move some Ethernet support files out of staging.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: netdev@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Patchwork: https://patchwork.linux-mips.org/patch/2942/
Patchwork: https://patchwork.linux-mips.org/patch/3012/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# afc4b13d 16-Aug-2011 Jiri Pirko <jpirko@redhat.com>

net: remove use of ndo_set_multicast_list in drivers

replace it by ndo_set_rx_mode

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# c4711c3a 28-Sep-2010 Vasiliy Kulikov <segooon@gmail.com>

staging: octeon: use free_netdev(netdev) instead of kfree()

It is not guaranteed that free_netdev() is macro.
Freeing netdev without free_netdev() leads to net, tx leaks.
I might lead to dereferencing freed pointer.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Acked-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 369ae8be 17-Sep-2010 Andy Shevchenko <andy.shevchenko@gmail.com>

staging: octeon: '&pointer[0]' to 'pointer' fix

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d225eef7 11-Sep-2010 Andy Shevchenko <andy.shevchenko@gmail.com>

staging: octeon: use '%pM' format to print MAC address

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 559e25a5 16-Feb-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon: Remove /proc/octeon_ethernet_stats

This file shouldn't be in /proc, so we remove it.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: netdev@vger.kernel.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/970/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# ec977c5b 16-Feb-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon: Reformat a bunch of comments.

Many of the comments didn't follow kerneldoc guidlines.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: netdev@vger.kernel.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/971/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 4898c560 15-Feb-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon: Free transmit SKBs in a timely manner

If we wait for the once-per-second cleanup to free transmit SKBs,
sockets with small transmit buffer sizes might spend most of their
time blocked waiting for the cleanup.

Normally we do a cleanup for each transmitted packet. We add a
watchdog type timer so that we also schedule a timeout for 150uS after
a packet is transmitted. The watchdog is reset for each transmitted
packet, so for high packet rates, it never expires. At these high
rates, the cleanups are done for each packet so the extra watchdog
initiated cleanups are neither needed nor triggered.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: netdev@vger.kernel.org
To: gregkh@suse.de
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Patchwork: http://patchwork.linux-mips.org/patch/968/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

This version has spelling and comment changes based on feedback from
Eric Dumazet.


# f8c26486 15-Feb-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon: Run phy bus accesses on a workqueue.

When directly accessing a phy, we must acquire the mdio bus lock. To
do that we cannot be in interrupt context, so we need to move these
operations to a workqueue.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: netdev@vger.kernel.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/965/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 1d08f00d 15-Feb-2010 David Daney <ddaney@caviumnetworks.com>

Staging: octeon: remove unneeded includes

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: netdev@vger.kernel.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/964/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 924cc268 07-Jan-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon Ethernet: Enable scatter-gather.

Octeon ethernet hardware can handle NETIF_F_SG, so we enable it.

A gather list of up to six fragments will fit in the SKB's CB
structure, so no extra memory is required. If a SKB has more than six
fragments, we must linearize it.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/838/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 3368c784 07-Jan-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon Ethernet: Convert to NAPI.

Convert the driver to be a reasonably well behaved NAPI citizen.

There is one NAPI instance per CPU shared between all input ports. As
receive backlog increases, NAPI is scheduled on additional CPUs.

Receive buffer refill code factored out so it can also be called from
the periodic timer. This is needed to recover from temporary buffer
starvation conditions.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/839/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 6888fc87 07-Jan-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon Ethernet: Rewrite transmit code.

Stop the queue if too many packets are queued. Restart it from a high
resolution timer.

Rearrange and simplify locking and SKB freeing code

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/843/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 6568a234 07-Jan-2010 David Daney <ddaney@caviumnetworks.com>

Staging: Octeon Ethernet: Remove unused code.

Remove unused code, reindent, and join some spilt strings.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
To: gregkh@suse.de
Patchwork: http://patchwork.linux-mips.org/patch/842/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# d5907942 17-Feb-2010 Jiri Pirko <jpirko@redhat.com>

staging: convert to use netdev_for_each_mc_addr

removed needless checks in arlan-main.c and slicoss.c
fixed bug in et131x_netdev.c to actually fill addresses in.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f6ed1b3b 14-Oct-2009 David Daney <ddaney@caviumnetworks.com>

Staging: octeon-ethernet: Convert to use PHY Abstraction Layer.

The octeon-ethernet driver shares an mdio bus with the octeon-mgmt
driver. Here we convert the octeon-ethernet driver to use the PHY
Abstraction Layer.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 13c5939e 12-Oct-2009 David Daney <ddaney@caviumnetworks.com>

Staging: octeon-ethernet: Assign proper MAC addresses.

Allocate MAC addresses using the same method as the bootloader. This
avoids changing the MAC between bootloader and kernel operation as
well as avoiding duplicates and use of addresses outside of the
assigned range.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# a620c163 23-Jun-2009 David Daney <ddaney@caviumnetworks.com>

Staging: octeon-ethernet: Fix race freeing transmit buffers.

The existing code had the following race:

Thread-1 Thread-2

inc/read in_use
inc/read in_use
inc tx_free_list[qos].len
inc tx_free_list[qos].len

The actual in_use value was incremented twice, but thread-1 is going
to free memory based on its stale value, and will free one too many
times. The result is that memory is freed back to the kernel while
its packet is still in the transmit buffer. If the memory is
overwritten before it is transmitted, the hardware will put a valid
checksum on it and send it out (just like it does with good packets).
If by chance the TCP flags are clobbered but not the addresses or
ports, the result can be a broken TCP stream.

The fix is to track the number of freed packets in a single location
(a Fetch-and-Add Unit register). That way it can never get out of sync
with itself.

We try to free up to MAX_SKB_TO_FREE (currently 10) buffers at a time.
If fewer are available we adjust the free count with the difference.
The action of claiming buffers to free is atomic so two threads cannot
claim the same buffers.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# f696a108 23-Jun-2009 David Daney <ddaney@caviumnetworks.com>

Staging: octeon-ethernet: Convert to use net_device_ops.

Convert the driver to use net_device_ops as it is now mandatory.

Also compensate for the removal of struct sk_buff's dst field.

The changes are mostly mechanical, the content of ethernet-common.c
was moved to ethernet.c and ethernet-common.{c,h} are removed.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>


# 80ff0fd3 05-May-2009 David Daney <ddaney@caviumnetworks.com>

Staging: Add octeon-ethernet driver files.

The octeon-ethernet driver supports the sgmii, rgmii, spi, and xaui
ports present on the Cavium OCTEON family of SOCs. These SOCs are
multi-core mips64 processors with existing support over in arch/mips.

The driver files can be categorized into three basic groups:

1) Register definitions, these are named cvmx-*-defs.h

2) Main driver code, these have names that don't start cvmx-.

3) Interface specific functions and other utility code, names starting
with cvmx-

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>