openwrt/staging/blogic.git
4 years agosfc: move some port link state/caps code
Alex Maftei (amaftei) [Thu, 9 Jan 2020 15:43:44 +0000 (15:43 +0000)]
sfc: move some port link state/caps code

The moved code handles MCDI port link state and capabilities.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: macb: add support for C45 MDIO read/write
Milind Parab [Thu, 9 Jan 2020 08:36:46 +0000 (08:36 +0000)]
net: macb: add support for C45 MDIO read/write

This patch modify MDIO read/write functions to support
communication with C45 PHY.

Signed-off-by: Milind Parab <mparab@cadence.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovmxnet3: Remove always false conditional statement
yuehaibing [Wed, 8 Jan 2020 14:08:22 +0000 (22:08 +0800)]
vmxnet3: Remove always false conditional statement

param->rx_mini_pending is __u32 variable, it will never
be less than zero.

Signed-off-by: yuehaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetronome: fix ipv6 link error
Arnd Bergmann [Wed, 8 Jan 2020 13:15:15 +0000 (14:15 +0100)]
netronome: fix ipv6 link error

When the driver is built-in but ipv6 is a module, the flower
support produces a link error:

drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.o: In function `nfp_tunnel_keep_alive_v6':
tunnel_conf.c:(.text+0x2aa8): undefined reference to `nd_tbl'

Add a Kconfig dependency to avoid that configuration.

Fixes: 9ea9bfa12240 ("nfp: flower: support ipv6 tunnel keep-alive messages from fw")
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: felix: fix link error
Arnd Bergmann [Wed, 8 Jan 2020 12:48:38 +0000 (13:48 +0100)]
net: dsa: felix: fix link error

When the enetc driver is disabled, the mdio support fails to
get built:

drivers/net/dsa/ocelot/felix_vsc9959.o: In function `vsc9959_mdio_bus_alloc':
felix_vsc9959.c:(.text+0x19c): undefined reference to `enetc_hw_alloc'
felix_vsc9959.c:(.text+0x1d1): undefined reference to `enetc_mdio_read'
felix_vsc9959.c:(.text+0x1d8): undefined reference to `enetc_mdio_write'

Change the Makefile to enter the subdirectory for this as well.

Fixes: bdeced75b13f ("net: dsa: felix: Add PCS operations for PHYLINK")
Fixes: 6517798dd343 ("enetc: Make MDIO accessors more generic and export to include/linux/fsl")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: add constant EnAnaPLL
Heiner Kallweit [Wed, 8 Jan 2020 06:36:08 +0000 (07:36 +0100)]
r8169: add constant EnAnaPLL

Use constant EnAnaPLL for bit 14 as in vendor driver. The vendor
driver sets this bit for chip version 02 only, but I'm not aware of
any issues, so better leave it as it is.
In addition remove the useless debug message.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: potential NULL dereference in strset_prepare_data()
Dan Carpenter [Wed, 8 Jan 2020 05:42:36 +0000 (08:42 +0300)]
ethtool: potential NULL dereference in strset_prepare_data()

Smatch complains that the NULL checking isn't done consistently:

    net/ethtool/strset.c:253 strset_prepare_data()
    error: we previously assumed 'dev' could be null (see line 233)

It looks like there is a missing return on this path.

Fixes: 71921690f974 ("ethtool: provide string sets with STRSET_GET request")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: fix ->reply_size() error handling
Dan Carpenter [Wed, 8 Jan 2020 05:41:25 +0000 (08:41 +0300)]
ethtool: fix ->reply_size() error handling

The "ret < 0" comparison is never true because "ret" is still zero.

Fixes: 728480f12442 ("ethtool: default handlers for GET requests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoethtool: fix a memory leak in ethnl_default_start()
Dan Carpenter [Wed, 8 Jan 2020 05:39:48 +0000 (08:39 +0300)]
ethtool: fix a memory leak in ethnl_default_start()

If ethnl_default_parse() fails then we need to free a couple
memory allocations before returning.

Fixes: 728480f12442 ("ethtool: default handlers for GET requests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Broadcom-tags-support-for-531x5-539x-families'
David S. Miller [Thu, 9 Jan 2020 00:01:14 +0000 (16:01 -0800)]
Merge branch 'Broadcom-tags-support-for-531x5-539x-families'

Florian Fainelli says:

====================
Broadcom tags support for 531x5/539x families

This patch series finally allows us to enable Broadcom tags on the
BCM531x5/BCM539x switch series which are very often cascaded onto
another on-chip Broadcom switch. Because of that we need to be able to
detect that Broadcom tags are already enabled on our DSA master which
happens to be a DSA slave in that case since they are not part of the
same DSA switch tree, the protocol does not support that.

Due to the way DSA works, get_tag_protocol() is called prior to
ds->ops->setup and we do not have all data structures set-up (in
particular dsa_port::cpu_dp is not filed yet) so doing this at the time
get_tag_protocol() is called and without exporting a helper function is
desirable to limit our footprint into the framework.

Having the core (net/dsa/dsa2.c) return and enforce DSA_TAG_PROTO_NONE
was considered and done initially but this leaves the driver outside of
the decision to force/fallback to a particular protocol, instead of
letting it in control. Also there is no reason to suspect that all
tagging protocols are problematic, e.g.: "inner" Marvell EDSA with
"outer" Broadcom tag may work just fine, and vice versa.

This was tested on:

- Lamobo R1 which now has working Broadcom tags for its external BCM53125 switch
- BCM7445 which has a BCM53125 hanging off one of its internal switch
  port, the BCM53125 still works with DSA_TAG_PROTO_NONE
- BCM7278 which has a peculiar dual CPU port set-up (so dual IMP mode
  needs to be enabled)
- Northstar Plus with DSA_TAG_PROTO_BRCM_PREPEND and no external
  switches hanging off the internal switch
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: b53: Enable Broadcom tags for 531x5/539x families
Florian Fainelli [Wed, 8 Jan 2020 05:06:06 +0000 (21:06 -0800)]
net: dsa: b53: Enable Broadcom tags for 531x5/539x families

The BCM531x5 and BCM539x families require that the IMP port be enabled
within the management page and that management mode (SM_SW_FWD_MODE) be
turned on. Once this is done, everything works as expected, including
multicast with standalone DSA devices or bridge devices.

Because such switches are frequencly cascaded with other internal
Broadcom switches on which we want to enable Broadcom tags, update
b53_can_enable_brcm_tags() to check the kind of DSA master tagging
protocol being used, if it is one of the two supported Broadcom tagging
protocols, force DSA_TAG_PROTO_NONE.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: Get information about stacked DSA protocol
Florian Fainelli [Wed, 8 Jan 2020 05:06:05 +0000 (21:06 -0800)]
net: dsa: Get information about stacked DSA protocol

It is possible to stack multiple DSA switches in a way that they are not
part of the tree (disjoint) but the DSA master of a switch is a DSA
slave of another. When that happens switch drivers may have to know this
is the case so as to determine whether their tagging protocol has a
remove chance of working.

This is useful for specific switch drivers such as b53 where devices
have been known to be stacked in the wild without the Broadcom tag
protocol supporting that feature. This allows b53 to continue supporting
those devices by forcing the disabling of Broadcom tags on the outermost
switches if necessary.

The get_tag_protocol() function is therefore updated to gain an
additional enum dsa_tag_protocol argument which denotes the current
tagging protocol used by the DSA master we are attached to, else
DSA_TAG_PROTO_NONE for the top of the dsa_switch_tree.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Devlink-notification-after-recovery-complete-by-bnxt_en-driver'
David S. Miller [Wed, 8 Jan 2020 23:47:50 +0000 (15:47 -0800)]
Merge branch 'Devlink-notification-after-recovery-complete-by-bnxt_en-driver'

Vikas Gupta says:

====================
Devlink notification after recovery complete by bnxt_en driver

 This patchset adds following feature in devlink
  1) Recovery complete direct call API to be used by drivers when it
     successfully completes. It is required as recovery triggered by
     devlink may return with EINPROGRESS and eventually recovery
     completes in different context.
  2) A notification when health status is updated by reporter.

 Patchset also contains required changes in bnxt_en driver to
 mark recovery in progress when recovery is triggered from kernel
 devlink.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Call recovery done after reset is successfully done
Vikas Gupta [Thu, 2 Jan 2020 15:48:11 +0000 (21:18 +0530)]
bnxt_en: Call recovery done after reset is successfully done

Return EINPROGRESS to devlink health reporter recover as we are not yet
done and call devlink_health_reporter_recovery_done once reset is
successfully completed from workqueue context.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add devink notification when reporter update health state
Vikas Gupta [Thu, 2 Jan 2020 15:48:10 +0000 (21:18 +0530)]
devlink: add devink notification when reporter update health state

add a devlink notification when reporter update the health
state.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodevlink: add support for reporter recovery completion
Vikas Gupta [Thu, 2 Jan 2020 15:48:09 +0000 (21:18 +0530)]
devlink: add support for reporter recovery completion

It is possible that a reporter recovery completion do not finish
successfully when recovery is triggered via
devlink_health_reporter_recover as recovery could be processed in
different context. In such scenario an error is returned by driver when
recover hook is invoked and successful recovery completion is
intimated later.
Expose devlink recover done API to update recovery stats.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'reduce-open-coded-skb-next-access-for-gso-segment-walking'
David S. Miller [Wed, 8 Jan 2020 23:19:55 +0000 (15:19 -0800)]
Merge branch 'reduce-open-coded-skb-next-access-for-gso-segment-walking'

Jason A. Donenfeld says:

====================
reduce open coded skb->next access for gso segment walking

This patchset introduces the skb_list_walk_safe helper macro, in order
to add some sanity to the myrid ways drivers have of walking through gso
segments. The goal is to reduce future bugs commonly caused by open
coding these sorts of things, and to in the future make it easier to
swap out the underlying list representation.

This first patch series addresses the easy uses of drivers iterating
over the returned list of skb_gso_segments, for drivers that live in
drivers/net/*. There are still other use cases to tackle later for
net/*, and after these low-hanging fruits are taken care of, I imagine
there are more subtle cases of gso segment walking that isn't just a
direct return value from skb_gso_segments, and eventually this will have
to be tackled. This series is the first in that direction.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: iwlwifi: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:09 +0000 (16:59 -0500)]
net: iwlwifi: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: myri10ge: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:08 +0000 (16:59 -0500)]
net: myri10ge: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sfc: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:07 +0000 (16:59 -0500)]
net: sfc: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sunvnet: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:06 +0000 (16:59 -0500)]
net: sunvnet: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: tg3: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:05 +0000 (16:59 -0500)]
net: tg3: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: r8152: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:04 +0000 (16:59 -0500)]
net: r8152: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: tap: use skb_list_walk_safe helper for gso segments
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:03 +0000 (16:59 -0500)]
net: tap: use skb_list_walk_safe helper for gso segments

This is a straight-forward conversion case for the new function, and
while we're at it, we can remove a null write to skb->next by replacing
it with skb_mark_not_on_list.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: introduce skb_list_walk_safe for skb segment walking
Jason A. Donenfeld [Wed, 8 Jan 2020 21:59:02 +0000 (16:59 -0500)]
net: introduce skb_list_walk_safe for skb segment walking

As part of the continual effort to remove direct usage of skb->next and
skb->prev, this patch adds a helper for iterating through the
singly-linked variant of skb lists, which are used for lists of GSO
packet. The name "skb_list_..." has been chosen to match the existing
function, "kfree_skb_list, which also operates on these singly-linked
lists, and the "..._walk_safe" part is the same idiom as elsewhere in
the kernel.

This patch removes the helper from wireguard and puts it into
linux/skbuff.h, while making it a bit more robust for general usage. In
particular, parenthesis are added around the macro argument usage, and it
now accounts for trying to iterate through an already-null skb pointer,
which will simply run the iteration zero times. This latter enhancement
means it can be used to replace both do { ... } while and while (...)
open-coded idioms.

This should take care of these three possible usages, which match all
current methods of iterations.

skb_list_walk_safe(segs, skb, next) { ... }
skb_list_walk_safe(skb, skb, next) { ... }
skb_list_walk_safe(segs, skb, segs) { ... }

Gcc appears to generate efficient code for each of these.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosocket: fix unused-function warning
Arnd Bergmann [Wed, 8 Jan 2020 21:44:43 +0000 (22:44 +0100)]
socket: fix unused-function warning

When procfs is disabled, the fdinfo code causes a harmless
warning:

net/socket.c:1000:13: error: 'sock_show_fdinfo' defined but not used [-Werror=unused-function]
 static void sock_show_fdinfo(struct seq_file *m, struct file *f)

Move the function definition up so we can use a single #ifdef
around it.

Fixes: b4653342b151 ("net: Allow to show socket-specific information in /proc/[pid]/fdinfo/[fd]")
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'sfc-code-refactoring'
David S. Miller [Wed, 8 Jan 2020 21:28:03 +0000 (13:28 -0800)]
Merge branch 'sfc-code-refactoring'

Alex Maftei says:

====================
sfc: code refactoring

Splitting some of the driver code into different files, which will
later be used in another driver for a new product.
====================

Reviewed-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move common tx code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:14:00 +0000 (16:14 +0000)]
sfc: move common tx code

Once again, a tiny bit of refactoring was required to stitch the code
together (i.e. adding headers). The moved code deals with managing tx
queues and mappings.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move common rx code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:13:43 +0000 (16:13 +0000)]
sfc: move common rx code

The moved code deals with managing rx buffers and queues.
A tiny bit of refactoring was required in other files to stitch the
code together.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move event queue management code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:13:28 +0000 (16:13 +0000)]
sfc: move event queue management code

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move channel interrupt management code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:13:10 +0000 (16:13 +0000)]
sfc: move channel interrupt management code

Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move channel alloc/removal code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:12:56 +0000 (16:12 +0000)]
sfc: move channel alloc/removal code

Reallocation and copying code is included, as well as some housekeeping
code.
Other files have been patched up a bit to accommodate the changes.

Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move channel start/stop code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:12:34 +0000 (16:12 +0000)]
sfc: move channel start/stop code

Also includes interrupt enabling/disabling code.
Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move some channel-related code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:12:18 +0000 (16:12 +0000)]
sfc: move some channel-related code

Just a handful of function, but also removed many 'static' identifiers
so the code builds. These will, of course, be moved.
Module parameters for IRQ moderation threshold also moved.

Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move struct init and fini code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:12:04 +0000 (16:12 +0000)]
sfc: move struct init and fini code

The hardware monitor code and the reset work queue code were also
moved, with supporting macros and parameters, because they are assigned
to function pointers in the struct.
Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move some device reset code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:11:46 +0000 (16:11 +0000)]
sfc: move some device reset code

The rest of the reset code will be moved later.
Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move datapath management code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:11:29 +0000 (16:11 +0000)]
sfc: move datapath management code

The code that manages the datapath (starting, stopping, including the
port-related bits) will be common.
Three functions have been added that contain bits from other
functions. These will be moved to their final files in later patches.
Small code styling fixes included.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move mac configuration and status functions
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:11:13 +0000 (16:11 +0000)]
sfc: move mac configuration and status functions

Two small functions with different purposes.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: move reset workqueue code
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:10:59 +0000 (16:10 +0000)]
sfc: move reset workqueue code

Small functions doing work that will be common, related to reset
workqueue management.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: further preparation for code split
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:10:45 +0000 (16:10 +0000)]
sfc: further preparation for code split

Added more arguments for a couple of functions.
Also moved a function to the common header.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: add new headers in preparation for code split
Alex Maftei (amaftei) [Wed, 8 Jan 2020 16:10:32 +0000 (16:10 +0000)]
sfc: add new headers in preparation for code split

New headers contain prototypes of functions that will be common between
ef10 and upcoming driver.
Removed static modifier from the affected functions.
Some function prototypes were removed from existing headers.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohsr: fix dummy hsr_debugfs_rename() declaration
Arnd Bergmann [Tue, 7 Jan 2020 20:03:39 +0000 (21:03 +0100)]
hsr: fix dummy hsr_debugfs_rename() declaration

The hsr_debugfs_rename prototype got an extra 'void' that needs to
be removed again:

In file included from /git/arm-soc/net/hsr/hsr_main.c:12:
net/hsr/hsr_main.h:194:20: error: two or more data types in declaration specifiers
 static inline void void hsr_debugfs_rename(struct net_device *dev)

Fixes: 4c2d5e33dcd3 ("hsr: rename debugfs file when interface name is changed")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/ncsi: Send device address as source address
Vijay Khemka [Tue, 7 Jan 2020 19:30:33 +0000 (11:30 -0800)]
net/ncsi: Send device address as source address

After receiving device mac address from device, send this as
a source address for further commands instead of broadcast
address.

This will help in multi host NIC cards.

Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: 3com: 3c59x: remove set but not used variable 'mii_reg1'
yu kuai [Mon, 6 Jan 2020 14:18:45 +0000 (22:18 +0800)]
net: 3com: 3c59x: remove set but not used variable 'mii_reg1'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/ethernet/3com/3c59x.c: In function ‘vortex_up’:
drivers/net/ethernet/3com/3c59x.c:1551:9: warning: variable
‘mii_reg1’ set but not used [-Wunused-but-set-variable]

It is never used, and so can be removed.

Signed-off-by: yu kuai <yukuai3@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'mlx5-updates-2020-01-07' of git://git.kernel.org/pub/scm/linux/kernel...
David S. Miller [Wed, 8 Jan 2020 20:25:42 +0000 (12:25 -0800)]
Merge tag 'mlx5-updates-2020-01-07' of git://git./linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2020-01-07

This series adds 2 sets of changes to mlx5 driver
1) Misc updates and cleanups:

1.1) Stack usages warning cleanups and log level reduction
1.2) Increase the max number of supported rings
1.3) Support accept TC action on native NIC netdev.

2) Software steering support for multi destination steering rules:
First three patches from Erez are adding the low level FW command support
and SW steering infrastructure to create the mult-destination FW tables.

Last four patches from Alex are introducing the needed changes and APIs in
SW steering to create and manage multi-destination actions and rules.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/rose: remove redundant assignment to variable failed
Colin Ian King [Tue, 7 Jan 2020 15:24:15 +0000 (15:24 +0000)]
net/rose: remove redundant assignment to variable failed

The variable failed is being assigned a value that is never read, the
following goto statement jumps to the end of the function and variable
failed is not referenced at all.  Remove the redundant assignment.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoptp: clockmatrix: Rework clockmatrix version information.
Vincent Cheng [Tue, 7 Jan 2020 14:47:57 +0000 (09:47 -0500)]
ptp: clockmatrix: Rework clockmatrix version information.

Simplify and fix the version information displayed by the driver.
The new info better relects what is needed to support the hardware.

Prev:
Version: 4.8.0, Pipeline 22169 0x4001, Rev 0, Bond 5, CSR 311, IRQ 2

New:
Version: 4.8.0, Id: 0x4001  Hw Rev: 5  OTP Config Select: 15

- Remove pipeline, CSR and IRQ because version x.y.z already incorporates
  this information.
- Remove bond number because it is not used.
- Remove rev number because register was not implemented, always 0
- Add HW Rev ID register to replace rev number
- Add OTP config select to show the user configuration chosen by
  the configurable GPIO pins on start-up

Signed-off-by: Vincent Cheng <vincent.cheng.xh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoenetc: Fix inconsistent IS_ERR and PTR_ERR
YueHaibing [Tue, 7 Jan 2020 14:14:54 +0000 (22:14 +0800)]
enetc: Fix inconsistent IS_ERR and PTR_ERR

The proper pointer to be passed as argument is hw
Detected using Coccinelle.

Fixes: 6517798dd343 ("enetc: Make MDIO accessors more generic and export to include/linux/fsl")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoenetc: Fix an off by one in enetc_setup_tc_txtime()
Dan Carpenter [Tue, 7 Jan 2020 13:11:43 +0000 (16:11 +0300)]
enetc: Fix an off by one in enetc_setup_tc_txtime()

The priv->tx_ring[] has 16 elements but only priv->num_tx_rings are
set up, the rest are NULL.  This ">" comparison should be ">=" to avoid
a potential crash.

Fixes: 0d08c9ec7d6e ("enetc: add support time specific departure base on the qos etf")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Documentation-stmmac-documentation-improvements'
David S. Miller [Tue, 7 Jan 2020 21:38:56 +0000 (13:38 -0800)]
Merge branch 'Documentation-stmmac-documentation-improvements'

Jose Abreu says:

====================
Documentation: stmmac documentation improvements

Converts stmmac documentation to RST format.

1) Adds missing entry of stmmac documentation to MAINTAINERS.

2) Converts stmmac documentation to RST format and adds some new info.

3) Adds the new RST file to the list of files.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoDocumentation: networking: Add stmmac to device drivers list
Jose Abreu [Tue, 7 Jan 2020 10:37:20 +0000 (11:37 +0100)]
Documentation: networking: Add stmmac to device drivers list

Add the stmmac RST file to the index.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoDocumentation: networking: Convert stmmac documentation to RST format
Jose Abreu [Tue, 7 Jan 2020 10:37:19 +0000 (11:37 +0100)]
Documentation: networking: Convert stmmac documentation to RST format

Convert the documentation of the driver to RST format and delete the old
txt and old information that no longer applies.

Also, add some new information.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMAINTAINERS: Add stmmac Ethernet driver documentation entry
Jose Abreu [Tue, 7 Jan 2020 10:37:18 +0000 (11:37 +0100)]
MAINTAINERS: Add stmmac Ethernet driver documentation entry

Add the missing entry for the file that documents the stmicro Ethernet
driver stmmac.

Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodrivers: net: cisco_hdlc: use __func__ in debug message
Chen Zhou [Tue, 7 Jan 2020 09:33:46 +0000 (17:33 +0800)]
drivers: net: cisco_hdlc: use __func__ in debug message

Use __func__ to print the function name instead of hard coded string.
BTW, replace printk(KERN_DEBUG, ...) with netdev_dbg.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ch9200-code-cleanup'
David S. Miller [Tue, 7 Jan 2020 21:30:36 +0000 (13:30 -0800)]
Merge branch 'net-ch9200-code-cleanup'

Chen Zhou says:

====================
net: ch9200: code cleanup

patch 1 introduce __func__ in debug message.
patch 2 remove unnecessary return.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ch9200: remove unnecessary return
Chen Zhou [Tue, 7 Jan 2020 09:28:56 +0000 (17:28 +0800)]
net: ch9200: remove unnecessary return

The return is not needed, remove it.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ch9200: use __func__ in debug message
Chen Zhou [Tue, 7 Jan 2020 09:28:55 +0000 (17:28 +0800)]
net: ch9200: use __func__ in debug message

Use __func__ to print the function name instead of hard coded string.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ionic-driver-updates'
David S. Miller [Tue, 7 Jan 2020 21:05:06 +0000 (13:05 -0800)]
Merge branch 'ionic-driver-updates'

Shannon Nelson says:

====================
ionic: driver updates

These are a few little updates for the ionic network driver.

v2: dropped IBM msi patch
    added fix for a compiler warning
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoionic: clear compiler warning on hb use before set
Shannon Nelson [Tue, 7 Jan 2020 03:43:49 +0000 (19:43 -0800)]
ionic: clear compiler warning on hb use before set

Build checks have pointed out that 'hb' can theoretically
be used before set, so let's initialize it and get rid
of the compiler complaint.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoionic: restrict received packets to mtu size
Shannon Nelson [Tue, 7 Jan 2020 03:43:48 +0000 (19:43 -0800)]
ionic: restrict received packets to mtu size

Make sure the NIC drops packets that are larger than the
specified MTU.

The front end of the NIC will accept packets larger than MTU and
will copy all the data it can to fill up the driver's posted
buffers - if the buffers are not long enough the packet will
then get dropped.  With the Rx SG buffers allocagted as full
pages, we are currently setting up more space than MTU size
available and end up receiving some packets that are larger
than MTU, up to the size of buffers posted.  To be sure the
NIC doesn't waste our time with oversized packets we need to
lie a little in the SG descriptor about how long is the last
SG element.

At dealloc time, we know the allocation was a page, so the
deallocation doesn't care about what length we put in the
descriptor.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoionic: add Rx dropped packet counter
Shannon Nelson [Tue, 7 Jan 2020 03:43:47 +0000 (19:43 -0800)]
ionic: add Rx dropped packet counter

Add a counter for packets dropped by the driver, typically
for bad size or a receive error seen by the device.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoionic: drop use of subdevice tags
Shannon Nelson [Tue, 7 Jan 2020 03:43:46 +0000 (19:43 -0800)]
ionic: drop use of subdevice tags

The subdevice concept is not being used in the driver, so
drop the references to it.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/mlx5: DR, Create multiple destination action from dr_create_fte
Alex Vesker [Sun, 15 Dec 2019 19:50:32 +0000 (21:50 +0200)]
net/mlx5: DR, Create multiple destination action from dr_create_fte

Until now it was possible to pass a packet to a single destination such
as vport or flow table. With the new support if multiple vports or multiple
tables are provided as destinations, fs_dr will create a multiple
destination table action, this action should replace other destination
actions provided to mlx5dr_create_rule.
Each vport destination can be provided with a reformat actions which
will be done before forwarding the packet to the vport.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR, Add support for multiple destination table action
Alex Vesker [Sun, 15 Dec 2019 19:27:54 +0000 (21:27 +0200)]
net/mlx5: DR, Add support for multiple destination table action

A multiple destination table action allows HW packet duplication
to multiple destinations, this is useful for multicast or mirroring
traffic for debug. Duplicating is done using a FW flow table with
multiple destinations.

The new action creation function, mlx5dr_action_create_mult_dest_tbl
will allow creating a single table to iterate over several dr actions.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR, Align dest FT action creation to API
Alex Vesker [Sun, 15 Dec 2019 19:15:15 +0000 (21:15 +0200)]
net/mlx5: DR, Align dest FT action creation to API

Function prefix was changed to be similar to other action APIs.
In order to support other FW tables the mlx5_flow_table struct was
replaced with table id and type.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR, Pass table flags at creation to lower layer
Erez Shitrit [Thu, 2 Jan 2020 14:55:45 +0000 (16:55 +0200)]
net/mlx5: DR, Pass table flags at creation to lower layer

We need to have the flow-table flags when creation sw-steering tables,
this parameter exists in the layer between fs_core to sw_steering, this
patch gives it to the creation function.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR, Create multi-destination table for SW-steering use
Erez Shitrit [Tue, 24 Dec 2019 20:54:15 +0000 (22:54 +0200)]
net/mlx5: DR, Create multi-destination table for SW-steering use

Currently SW steering doesn't have the means to access HW iterators to
support multi-destination (FTEs) flow table entries.

In order to support multi-destination FTEs for port-mirroring, SW
steering will create a dedicated multi-destination FW managed flow table
and FTEs via direct FW commands that we introduced in the previous patch.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR, Create FTE entry in the FW from SW-steering
Erez Shitrit [Thu, 2 Jan 2020 13:54:35 +0000 (15:54 +0200)]
net/mlx5: DR, Create FTE entry in the FW from SW-steering

Implement the FW command to setup a FTE (Flow Table Entry) into the FW
managed flow tables.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: DR, Use attributes struct for FW flow table creation
Alex Vesker [Tue, 24 Dec 2019 20:52:03 +0000 (22:52 +0200)]
net/mlx5: DR, Use attributes struct for FW flow table creation

Instead of using multiple variables use a simple struct. The
number of passed argument was too high after adding the encap
decap support bits arguments used for multiple destination reformat.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Use async EQ setup cleanup helpers for multiple EQs
Parav Pandit [Fri, 6 Dec 2019 21:13:41 +0000 (15:13 -0600)]
net/mlx5: Use async EQ setup cleanup helpers for multiple EQs

Use helper routines to setup and teardown multiple EQs and reuse the
code in setup, cleanup and error unwinding flows.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Reduce No CQ found log level from warn to debug
Parav Pandit [Thu, 5 Dec 2019 22:06:20 +0000 (16:06 -0600)]
net/mlx5: Reduce No CQ found log level from warn to debug

In below sequence, a EQE entry arrives for a CQ which is on the path of
being destroyed.

           cpu-0               cpu-1
           ------              -----
mlx5_core_destroy_cq()      mlx5_eq_comp_int()
  mlx5_eq_del_cq()          [..]
    radix_tree_delete()     [..]
  [..]                         mlx5_eq_cq_get() /* Didn't find CQ is
                                                 * a valid case.
                                                 */
  /* destroy CQ in hw */
  mlx5_cmd_exec()

This is still a valid scenario and correct delete CQ sequence, as
mirror of the CQ create sequence.
Hence, suppress the non harmful debug message from warn to debug level.
Keep the debug log message rate limited because user application can
trigger it repeatedly.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: Increase the max number of channels to 128
Fan Li [Mon, 16 Dec 2019 12:46:15 +0000 (14:46 +0200)]
net/mlx5: Increase the max number of channels to 128

Currently the max number of channels is limited to 64, which is half of
the indirection table size to allow some flexibility. But on servers
with more than 64 cores, users may want to utilize more queues.

This patch increases the advertised max number of channels to 128 by
changing the ratio between channels and indirection table slots to 1:1.
At the same time, the driver still enable no more than 64 channels at
loading. Users can change it by ethtool afterwards.

Signed-off-by: Fan Li <fanl@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5e: Support accept action on nic table
Tonghao Zhang [Tue, 10 Dec 2019 14:49:42 +0000 (22:49 +0800)]
net/mlx5e: Support accept action on nic table

In one case, we may forward packets from one vport
to others, but only one packets flow will be accepted,
which destination ip was assign to VF.

+-----+     +-----+            +-----+
| VFn |     | VF1 |            | VF0 | accept
+--+--+     +--+--+  hairpin   +--^--+
   |           | <--------------- |
   |           |                  |
+--+-----------v-+             +--+-------------+
|   eswitch PF1  |             |   eswitch PF0  |
+----------------+             +----------------+

tc filter add dev $PF0 protocol all parent ffff: prio 1 handle 1 \
flower skip_sw action mirred egress redirect dev $VF0_REP
tc filter add dev $VF0 protocol ip  parent ffff: prio 1 handle 1 \
flower skip_sw dst_ip $VF0_IP action pass
tc filter add dev $VF0 protocol all parent ffff: prio 2 handle 2 \
flower skip_sw action mirred egress redirect dev $VF1

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agomlx5: work around high stack usage with gcc
Arnd Bergmann [Sat, 4 Jan 2020 21:51:44 +0000 (22:51 +0100)]
mlx5: work around high stack usage with gcc

In some configurations, gcc tries too hard to optimize this code:

drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function 'mlx5e_grp_sw_update_stats':
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:302:1: error: the frame size of 1336 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

As was stated in the bug report, the reason is that gcc runs into a corner
case in the register allocator that is rather hard to fix in a good way.

As there is an easy way to work around it, just add a comment and the
barrier that stops gcc from trying to overoptimize the function.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657
Cc: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agonet/mlx5: limit the function in local scope
Zhu Yanjun [Sat, 14 Dec 2019 08:51:17 +0000 (10:51 +0200)]
net/mlx5: limit the function in local scope

The function mlx5_buf_alloc_node is only used by the function in the
local scope. So it is appropriate to limit this function in the local
scope.

Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
4 years agoMerge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Tue, 7 Jan 2020 02:44:48 +0000 (18:44 -0800)]
Merge branch '1GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2020-01-06

This series contains updates to igc to add basic support for
timestamping.

Vinicius adds basic support for timestamping and enables ptp4l/phc2sys
to work with i225 devices.  Initially, adds the ability to read and
adjust the PHC clock.  Patches 2 & 3 enable and retrieve hardware
timestamps.  Patch 4 implements the ethtool ioctl that ptp4l uses to
check what timestamping methods are supported.  Lastly, added support to
do timestamping using the "Start of Packet" signal from the PHY, which
is now supported in i225 devices.

While i225 does support multiple PTP domains, with multiple timestamping
registers, we currently only support one PTP domain and use only one of
the timestamping registers for implementation purposes.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'Unique-mv88e6xxx-IRQ-names'
David S. Miller [Tue, 7 Jan 2020 02:30:15 +0000 (18:30 -0800)]
Merge branch 'Unique-mv88e6xxx-IRQ-names'

Andrew Lunn says:

====================
Unique mv88e6xxx IRQ names

There are a few boards which have multiple mv88e6xxx switches. With
such boards, it can be hard to determine which interrupts belong to
which switches. Make the interrupt names unique by including the
device name in the interrupt name. For the SERDES interrupt, also
include the port number. As a result of these patches ZII devel C
looks like:

 50:          0  gpio-vf610  27 Level     mv88e6xxx-0.1:00
 54:          0  mv88e6xxx-g1   3 Edge      mv88e6xxx-0.1:00-g1-atu-prob
 56:          0  mv88e6xxx-g1   5 Edge      mv88e6xxx-0.1:00-g1-vtu-prob
 58:          0  mv88e6xxx-g1   7 Edge      mv88e6xxx-0.1:00-g2
 61:          0  mv88e6xxx-g2   1 Edge      !mdio-mux!mdio@1!switch@0!mdio:01
 62:          0  mv88e6xxx-g2   2 Edge      !mdio-mux!mdio@1!switch@0!mdio:02
 63:          0  mv88e6xxx-g2   3 Edge      !mdio-mux!mdio@1!switch@0!mdio:03
 64:          0  mv88e6xxx-g2   4 Edge      !mdio-mux!mdio@1!switch@0!mdio:04
 70:          0  mv88e6xxx-g2  10 Edge      mv88e6xxx-0.1:00-serdes-10
 75:          0  mv88e6xxx-g2  15 Edge      mv88e6xxx-0.1:00-watchdog
 76:          5  gpio-vf610  26 Level     mv88e6xxx-0.2:00
 80:          0  mv88e6xxx-g1   3 Edge      mv88e6xxx-0.2:00-g1-atu-prob
 82:          0  mv88e6xxx-g1   5 Edge      mv88e6xxx-0.2:00-g1-vtu-prob
 84:          4  mv88e6xxx-g1   7 Edge      mv88e6xxx-0.2:00-g2
 87:          2  mv88e6xxx-g2   1 Edge      !mdio-mux!mdio@2!switch@0!mdio:01
 88:          0  mv88e6xxx-g2   2 Edge      !mdio-mux!mdio@2!switch@0!mdio:02
 89:          0  mv88e6xxx-g2   3 Edge      !mdio-mux!mdio@2!switch@0!mdio:03
 90:          0  mv88e6xxx-g2   4 Edge      !mdio-mux!mdio@2!switch@0!mdio:04
 95:          3  mv88e6xxx-g2   9 Edge      mv88e6xxx-0.2:00-serdes-9
 96:          0  mv88e6xxx-g2  10 Edge      mv88e6xxx-0.2:00-serdes-10
101:          0  mv88e6xxx-g2  15 Edge      mv88e6xxx-0.2:00-watchdog

Interrupt names like !mdio-mux!mdio@2!switch@0!mdio:01 are created by
phylib for the integrated PHYs. The mv88e6xxx driver does not
determine these names.
====================

Tested-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Unique ATU and VTU IRQ names
Andrew Lunn [Mon, 6 Jan 2020 16:13:52 +0000 (17:13 +0100)]
net: dsa: mv88e6xxx: Unique ATU and VTU IRQ names

Dynamically generate a unique interrupt name for the VTU and ATU,
based on the device name.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Unique g2 IRQ name
Andrew Lunn [Mon, 6 Jan 2020 16:13:51 +0000 (17:13 +0100)]
net: dsa: mv88e6xxx: Unique g2 IRQ name

Dynamically generate a unique g2 interrupt name, based on the
device name.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Unique watchdog IRQ name
Andrew Lunn [Mon, 6 Jan 2020 16:13:50 +0000 (17:13 +0100)]
net: dsa: mv88e6xxx: Unique watchdog IRQ name

Dynamically generate a unique watchdog interrupt name, based on the
device name.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Unique SERDES interrupt names
Andrew Lunn [Mon, 6 Jan 2020 16:13:49 +0000 (17:13 +0100)]
net: dsa: mv88e6xxx: Unique SERDES interrupt names

Dynamically generate a unique SERDES interrupt name, based on the
device name and the port the SERDES is for. For example:

 95:          3  mv88e6xxx-g2   9 Edge      mv88e6xxx-0.2:00-serdes-9
 96:          0  mv88e6xxx-g2  10 Edge      mv88e6xxx-0.2:00-serdes-10

The 0.2:00 indicates the switch and -9 indicates port 9.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: dsa: mv88e6xxx: Unique IRQ name
Andrew Lunn [Mon, 6 Jan 2020 16:13:48 +0000 (17:13 +0100)]
net: dsa: mv88e6xxx: Unique IRQ name

Dynamically generate a unique switch interrupt name, based on the
device name.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoigc: Use Start of Packet signal from PHY for timestamping
Vinicius Costa Gomes [Mon, 2 Dec 2019 23:19:53 +0000 (15:19 -0800)]
igc: Use Start of Packet signal from PHY for timestamping

For better accuracy, i225 is able to do timestamping using the Start of
Packet signal from the PHY.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Add support for ethtool GET_TS_INFO command
Vinicius Costa Gomes [Mon, 2 Dec 2019 23:19:52 +0000 (15:19 -0800)]
igc: Add support for ethtool GET_TS_INFO command

This command allows igc to report what types of timestamping are
supported. ptp4l uses this to detect if the hardware supports
timestamping.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Add support for TX timestamping
Vinicius Costa Gomes [Mon, 2 Dec 2019 23:19:51 +0000 (15:19 -0800)]
igc: Add support for TX timestamping

This adds support for timestamping packets being transmitted.

Based on the code from i210. The basic differences is that i225 has 4
registers to store the transmit timestamps (i210 has one). Right now,
we only support retrieving from one register, support for using the
other registers will be added later.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Add support for RX timestamping
Vinicius Costa Gomes [Mon, 2 Dec 2019 23:19:50 +0000 (15:19 -0800)]
igc: Add support for RX timestamping

This adds support for timestamping received packets.

It is based on the i210, as many features of i225 work the same way.
The main difference from i210 is that i225 has support for choosing
the timer register to use when timestamping packets. Right now, we
only support using timer 0. The other difference is that i225 stores
two timestamps in the receive descriptor, right now, we only retrieve
one.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoMerge branch 'ethtool-allow-nesting-of-begin-and-complete-callbacks'
David S. Miller [Mon, 6 Jan 2020 21:54:55 +0000 (13:54 -0800)]
Merge branch 'ethtool-allow-nesting-of-begin-and-complete-callbacks'

Michal Kubecek says:

====================
ethtool: allow nesting of begin() and complete() callbacks

The ethtool ioctl interface used to guarantee that ethtool_ops callbacks
were always called in a block between calls to ->begin() and ->complete()
(if these are defined) and that this whole block was executed with RTNL
lock held:

rtnl_lock();
ops->begin();
/* other ethtool_ops calls */
ops->complete();
rtnl_unlock();

This prevented any nesting or crossing of the begin-complete blocks.
However, this is no longer guaranteed even for ioctl interface as at least
ethtool_phys_id() releases RTNL lock while waiting for a timer. With the
introduction of netlink ethtool interface, the begin-complete pairs are
naturally nested e.g. when a request triggers a netlink notification.

Fortunately, only minority of networking drivers implements begin() and
complete() callbacks and most of those that do, fall into three groups:

  - wrappers for pm_runtime_get_sync() and pm_runtime_put()
  - wrappers for clk_prepare_enable() and clk_disable_unprepare()
  - begin() checks netif_running() (fails if false), no complete()

First two have their own refcounting, third is safe w.r.t. nesting of the
blocks.

Only three in-tree networking drivers need an update to deal with nesting
of begin() and complete() calls: via-velocity and epic100 perform resume
and suspend on their own and wil6210 completely serializes the calls using
its own mutex (which would lead to a deadlock if a request request
triggered a netlink notification). The series addresses these problems.

changes between v1 and v2:
  - fix inverted condition in epic100 ethtool_begin() (thanks to Andrew
    Lunn)
====================

Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoepic100: allow nesting of ethtool_ops begin() and complete()
Michal Kubecek [Mon, 6 Jan 2020 06:39:41 +0000 (07:39 +0100)]
epic100: allow nesting of ethtool_ops begin() and complete()

Unlike most networking drivers using begin() and complete() ethtool_ops
callbacks to resume a device which is down and suspend it again when done,
epic100 does not use standard refcounted infrastructure but sets device
sleep state directly.

With the introduction of netlink ethtool interface, we may have nested
begin-complete blocks so that inner complete() would put the device back to
sleep for the rest of the outer block.

To avoid rewriting an old and not very actively developed driver, just add
a nesting counter and only perform resume and suspend on the outermost
level.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agovia-velocity: allow nesting of ethtool_ops begin() and complete()
Michal Kubecek [Mon, 6 Jan 2020 06:39:36 +0000 (07:39 +0100)]
via-velocity: allow nesting of ethtool_ops begin() and complete()

Unlike most networking drivers using begin() and complete() ethtool_ops
callbacks to resume a device which is down and suspend it again when done,
via-velocity does not use standard refcounted infrastructure but sets
device sleep state directly.

With the introduction of netlink ethtool interface, we may have nested
begin-complete blocks so that inner complete() would put the device back to
sleep for the rest of the outer block.

To avoid rewriting an old and not very actively developed driver, just add
a nesting counter and only perform resume and suspend on the outermost
level.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agowil6210: get rid of begin() and complete() ethtool_ops
Michal Kubecek [Mon, 6 Jan 2020 06:39:31 +0000 (07:39 +0100)]
wil6210: get rid of begin() and complete() ethtool_ops

The wil6210 driver locks a mutex in begin() ethtool_ops callback and
unlocks it in complete() so that all ethtool requests are serialized. This
is not going to work correctly with netlink interface; e.g. when ioctl
triggers a netlink notification, netlink code would call begin() again
while the mutex taken by ioctl code is still held by the same task.

Let's get rid of the begin() and complete() callbacks and move the mutex
locking into the remaining ethtool_ops handlers except get_drvinfo which
only copies strings that are not changing so that there is no need for
serialization.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agofcnal-test: Fix vrf argument in local tcp tests
David Ahern [Mon, 6 Jan 2020 04:02:05 +0000 (20:02 -0800)]
fcnal-test: Fix vrf argument in local tcp tests

The recent MD5 tests added duplicate configuration in the default VRF.
This change exposed a bug in existing tests designed to verify no
connection when client and server are not in the same domain. The
server should be running bound to the vrf device with the client run
in the default VRF (the -2 option is meant for validating connection
data). Fix the option for both tests.

While technically this is a bug in previous releases, the tests are
properly failing since the default VRF does not have any routing
configuration so there really is no need to backport to prior releases.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agogtp: simplify error handling code in 'gtp_encap_enable()'
Christophe JAILLET [Sun, 5 Jan 2020 17:36:07 +0000 (18:36 +0100)]
gtp: simplify error handling code in 'gtp_encap_enable()'

'gtp_encap_disable_sock(sk)' handles the case where sk is NULL, so there
is no need to test it before calling the function.

This saves a few line of code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Disable-checks-in-hardware-pipeline'
David S. Miller [Mon, 6 Jan 2020 21:38:37 +0000 (13:38 -0800)]
Merge branch 'mlxsw-Disable-checks-in-hardware-pipeline'

Ido Schimmel says:

====================
mlxsw: Disable checks in hardware pipeline

Amit says:

The hardware pipeline contains some checks that, by default, are
configured to drop packets. Since the software data path does not drop
packets due to these reasons and since we are interested in offloading
the software data path to hardware, then these checks should be disabled
in the hardware pipeline as well.

This patch set changes mlxsw to disable four of these checks and adds
corresponding selftests. The tests pass both when the software data path
is exercised (using veth pair) and when the hardware data path is
exercised (using mlxsw ports in loopback).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: router: Add test case for destination IP link-local
Amit Cohen [Sun, 5 Jan 2020 16:20:57 +0000 (18:20 +0200)]
selftests: forwarding: router: Add test case for destination IP link-local

Add test case to check that packets are not dropped when they need to be
routed and their destination is link-local, i.e., 169.254.0.0/16.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum: Disable DIP_LINK_LOCAL check in hardware pipeline
Amit Cohen [Sun, 5 Jan 2020 16:20:56 +0000 (18:20 +0200)]
mlxsw: spectrum: Disable DIP_LINK_LOCAL check in hardware pipeline

The check drops packets if they need to be routed and their destination
IP is link-local, i.e., belongs to 169.254.0.0/16 address range.

Disable the check since the kernel forwards such packets and does not
drop them.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: router: Add test case for source IP equals destination IP
Amit Cohen [Sun, 5 Jan 2020 16:20:55 +0000 (18:20 +0200)]
selftests: forwarding: router: Add test case for source IP equals destination IP

Add test case to check that packets are not dropped when they need to be
routed and their source IP equals to their destination IP.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum: Disable SIP_DIP check in hardware pipeline
Amit Cohen [Sun, 5 Jan 2020 16:20:54 +0000 (18:20 +0200)]
mlxsw: spectrum: Disable SIP_DIP check in hardware pipeline

The check drops packets if they need to be routed and their source IP
equals to their destination IP.

Disable the check since the kernel forwards such packets and does not
drop them.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: router: Add test case for multicast destination MAC mismatch
Amit Cohen [Sun, 5 Jan 2020 16:20:53 +0000 (18:20 +0200)]
selftests: forwarding: router: Add test case for multicast destination MAC mismatch

Add test case to check that packets are not dropped when they need to be
routed and their multicast MAC mismatched to their multicast destination
IP.

i.e., destination IP is multicast and
* for IPV4: DMAC !=  {01-00-5E-0 (25 bits), DIP[22:0]}
* for IPV6: DMAC !=  {33-33-0 (16 bits), DIP[31:0]}

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum: Disable MC_DMAC check in hardware pipeline
Amit Cohen [Sun, 5 Jan 2020 16:20:52 +0000 (18:20 +0200)]
mlxsw: spectrum: Disable MC_DMAC check in hardware pipeline

The check drops packets if they need to be routed and their multicast
MAC mismatched to their multicast destination IP.

For IPV4:
DMAC is mismatched if it is different from {01-00-5E-0 (25 bits),
DIP[22:0]}

For IPV6:
DMAC is mismatched if it is different from {33-33-0 (16 bits),
DIP[31:0]}

Disable the check since the kernel forwards such packets and does not
drop them.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: forwarding: router: Add test case for source IP in class E
Amit Cohen [Sun, 5 Jan 2020 16:20:51 +0000 (18:20 +0200)]
selftests: forwarding: router: Add test case for source IP in class E

Add test case to check that packets are not dropped when they need to be
routed and their source IP in class E, (i.e., 240.0.0.0 –
255.255.255.254).

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>