platform/kernel/linux-rpi.git
4 years agonet: hns3: Add support for using order 1 pages with a 4K buffer
Yunsheng Lin [Mon, 29 Jul 2019 02:53:30 +0000 (10:53 +0800)]
net: hns3: Add support for using order 1 pages with a 4K buffer

Hardware supports 0.5K, 1K, 2K, 4K RX buffer size, the
RX buffer can not be reused because the hns3_page_order
return 0 when page size and RX buffer size are both 4096.

So this patch changes the hns3_page_order to return 1 when
RX buffer is greater than half of the page size and page size
is less the 8192, and dev_alloc_pages has already been used
to allocate the compound page for RX buffer.

This patch also changes hnae3_* to hns3_* for page order
and RX buffer size calculation because they are used in
hns3 module.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add interrupt affinity support for misc interrupt
Yunsheng Lin [Mon, 29 Jul 2019 02:53:29 +0000 (10:53 +0800)]
net: hns3: add interrupt affinity support for misc interrupt

The misc interrupt is used to schedule the reset and mailbox
subtask, and service_task delayed_work is used to do periodic
management work each second.

This patch sets the above three subtask's affinity using the
misc interrupt' affinity.

Also this patch setups a affinity notify for misc interrupt to
allow user to change the above three subtask's affinity.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: make hclge_service use delayed workqueue
Yunsheng Lin [Mon, 29 Jul 2019 02:53:28 +0000 (10:53 +0800)]
net: hns3: make hclge_service use delayed workqueue

Use delayed work instead of using timers to trigger the
hclge_serive.

Simplify the code with one less middle function and in order
to support misc irq affinity.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add debug messages to identify eth down cause
Yonglong Liu [Mon, 29 Jul 2019 02:53:27 +0000 (10:53 +0800)]
net: hns3: add debug messages to identify eth down cause

Some times just see the eth interface have been down/up via
dmesg, but can not know why the eth down. So adds some debug
messages to identify the cause for this.

Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: modify firmware version display format
Yufeng Mo [Mon, 29 Jul 2019 02:53:26 +0000 (10:53 +0800)]
net: hns3: modify firmware version display format

This patch modifies firmware version display format in
hclge(vf)_cmd_init() and hns3_get_drvinfo(). Also, adds
some optimizations for firmware version display format.

Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: change GFP flag during lock period
Yufeng Mo [Mon, 29 Jul 2019 02:53:25 +0000 (10:53 +0800)]
net: hns3: change GFP flag during lock period

When allocating memory, the GFP_KERNEL cannot be used during the
spin_lock period. This is because it may cause scheduling when holding
spin_lock. This patch changes GFP flag to GFP_ATOMIC in this case.

Fixes: dd74f815dd41 ("net: hns3: Add support for rule add/delete for flow director")
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: lipeng 00277521 <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: remove upgrade reset level when reset fail
Huazhong Tan [Mon, 29 Jul 2019 02:53:24 +0000 (10:53 +0800)]
net: hns3: remove upgrade reset level when reset fail

Currently, hclge_reset_err_handle() will assert a global reset
when the failing count is smaller than MAX_RESET_FAIL_CNT, which
will affect other running functions.

So this patch removes this upgrading, and uses re-scheduling reset
task to do it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add a check for get_reset_level
Guangbin Huang [Mon, 29 Jul 2019 02:53:23 +0000 (10:53 +0800)]
net: hns3: add a check for get_reset_level

For some cases, ops->get_reset_level may not be implemented, so we
should check whether it is NULL before calling get_reset_level.

Signed-off-by: Guangbin Huang <huangguangbin@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add reset checking before set channels
Jian Shen [Mon, 29 Jul 2019 02:53:22 +0000 (10:53 +0800)]
net: hns3: add reset checking before set channels

hns3_set_channels() should check the resetting status firstly,
since the device will reinitialize when resetting. If the
reset has not completed, the hns3_set_channels() may access
invalid memory.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-spectrum_acl-Forbid-unsupported-filters'
David S. Miller [Sat, 27 Jul 2019 21:32:31 +0000 (14:32 -0700)]
Merge branch 'mlxsw-spectrum_acl-Forbid-unsupported-filters'

Ido Schimmel says:

====================
mlxsw: spectrum_acl: Forbid unsupported filters

Patches #1-#2 make mlxsw reject unsupported egress filters. These
include filters that match on VLAN and filters associated with a
redirect action. Patch #1 rejects such filters when they are configured
on egress and patch #2 rejects such filters when they are configured in
a shared block that user tries to bind to egress.

Patch #3 forbids matching on reserved TCP flags as this is not supported
by the current keys that mlxsw uses.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_flower: Forbid to offload match on reserved TCP flags bits
Jiri Pirko [Sat, 27 Jul 2019 17:32:57 +0000 (20:32 +0300)]
mlxsw: spectrum_flower: Forbid to offload match on reserved TCP flags bits

Matching on reserved TCP flags bits is only supported using custom
parser. Since the usecase for that is not known now, just forbid to
offload rules that match on these bits.

Reported-by: Alex Kushnarov <alexanderk@mellanox.com>
Signed-off-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_acl: Track rules that forbid egress block bind
Jiri Pirko [Sat, 27 Jul 2019 17:32:56 +0000 (20:32 +0300)]
mlxsw: spectrum_acl: Track rules that forbid egress block bind

Some matches and actions are not supported on egress. Track such rules
and forbid a bind of block which contains them to egress.

With this patch, the kernel tells the user he cannot do that:
$ tc qdisc add dev ens16np1 ingress_block 22 clsact
$ tc filter add block 22 protocol 802.1q pref 2 handle 101 flower vlan_id 100 skip_sw action pass
$ tc qdisc add dev ens16np2 egress_block 22 clsact
Error: mlxsw_spectrum: Block cannot be bound to egress because it contains unsupported rules.

Signed-off-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_flower: Forbid to offload mirred redirect on egress
Jiri Pirko [Sat, 27 Jul 2019 17:32:55 +0000 (20:32 +0300)]
mlxsw: spectrum_flower: Forbid to offload mirred redirect on egress

Spectrum ASIC does not support redirection on egress, so refuse to
insert such flows:

$ tc qdisc add dev ens16np1 clsact
$ tc filter add dev ens16np1 egress protocol all pref 1 handle 101 flower skip_sw action mirred egress redirect dev ens16np2
Error: mlxsw_spectrum: Redirect action is not supported on egress.

Signed-off-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 agoMerge branch 'r8169-improve-HW-csum-and-TSO-handling'
David S. Miller [Sat, 27 Jul 2019 21:25:07 +0000 (14:25 -0700)]
Merge branch 'r8169-improve-HW-csum-and-TSO-handling'

Heiner Kallweit says:

====================
r8169: improve HW csum and TSO handling

This series:
- delegates more tasks from the driver to the core
- enables HW csum and TSO per default
- copies quirks for buggy chip versions from vendor driver
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: enable HW csum and TSO
Heiner Kallweit [Fri, 26 Jul 2019 19:51:36 +0000 (21:51 +0200)]
r8169: enable HW csum and TSO

Enable HW csum and TSO per default except on known buggy chip versions.
Realtek confirmed that RTL8168evl has a HW issue with TSO.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: remove r8169_csum_workaround
Heiner Kallweit [Fri, 26 Jul 2019 19:50:34 +0000 (21:50 +0200)]
r8169: remove r8169_csum_workaround

The loop in r8169_csum_workaround is called only if in
msdn_giant_send_check a copy of the skb header needs to be made and
we don't have enough memory. Let's simply drop the packet in that case
so that we can remove r8169_csum_workaround.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: implement callback ndo_features_check
Heiner Kallweit [Fri, 26 Jul 2019 19:49:22 +0000 (21:49 +0200)]
r8169: implement callback ndo_features_check

Implement callback ndo_features_check and move all feature checks there.
This will allow us to get rid of r8169_csum_workaround() completely in
a subsequent step. Like in the vendor driver disable HW csum for short
packets on RTL8168b.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: set GSO size and segment limits
Heiner Kallweit [Fri, 26 Jul 2019 19:48:32 +0000 (21:48 +0200)]
r8169: set GSO size and segment limits

Set GSO max size and max segment number as in the vendor driver.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoipv6: remove printk
Jonathan Lemon [Fri, 26 Jul 2019 19:16:09 +0000 (12:16 -0700)]
ipv6: remove printk

ipv6_find_hdr() prints a non-rate limited error message
when it cannot find an ipv6 header at a specific offset.
This could be used as a DoS, so just remove it.

Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: align setting PME with vendor driver
Heiner Kallweit [Fri, 26 Jul 2019 18:56:20 +0000 (20:56 +0200)]
r8169: align setting PME with vendor driver

Align setting PME with the vendor driver. PMEnable is writable on
RTL8169 only, on later chip versions it's read-only. PME_SIGNAL is
used on chip versions from RTL8168evl with the exception of the
RTL8168f family.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlx4/en_netdev: allow offloading VXLAN over VLAN
Davide Caratti [Fri, 26 Jul 2019 18:18:12 +0000 (20:18 +0200)]
mlx4/en_netdev: allow offloading VXLAN over VLAN

ConnectX-3 Pro can offload transmission of VLAN packets with VXLAN inside:
enable tunnel offloads in dev->vlan_features, like it's done with other
NIC drivers (e.g. be2net and ixgbe).

It's no more necessary to change dev->hw_enc_features when VXLAN are added
or removed, since .ndo_features_check() already checks for VXLAN packet
where the UDP destination port matches the configured value. Just set
dev->hw_enc_features when the NIC is initialized, so that overlying VLAN
can correctly inherit the tunnel offload capabilities.

Changes since v1:
- avoid flipping hw_enc_features, instead of calling netdev notifiers,
  thanks to Saeed Mahameed
- squash two patches into a single one

CC: Paolo Abeni <pabeni@redhat.com>
CC: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodrivers: net: xgene: Move status variable declaration into CONFIG_ACPI block
Nathan Chancellor [Fri, 26 Jul 2019 16:20:37 +0000 (09:20 -0700)]
drivers: net: xgene: Move status variable declaration into CONFIG_ACPI block

When CONFIG_ACPI is unset (arm allyesconfig), status is unused.

drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c:383:14: warning:
unused variable 'status' [-Wunused-variable]
        acpi_status status;
                    ^
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c:440:14: warning:
unused variable 'status' [-Wunused-variable]
        acpi_status status;
                    ^
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c:697:14: warning: unused
variable 'status' [-Wunused-variable]
        acpi_status status;
                    ^

Move the declaration into the CONFIG_ACPI block so that there are no
compiler warnings.

Fixes: 570d785ba46b ("drivers: net: xgene: Remove acpi_has_method() calls")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: stmmac: Do not request stmmaceth clock
Thierry Reding [Fri, 26 Jul 2019 10:27:41 +0000 (12:27 +0200)]
net: stmmac: Do not request stmmaceth clock

The stmmaceth clock is specified by the slave_bus and apb_pclk clocks in
the device tree bindings for snps,dwc-qos-ethernet-4.10 compatible nodes
of this IP.

The subdrivers for these bindings will be requesting the stmmac clock
correctly at a later point, so there is no need to request it here and
cause an error message to be printed to the kernel log.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: stmmac: Make MDIO bus reset optional
Thierry Reding [Fri, 26 Jul 2019 10:27:40 +0000 (12:27 +0200)]
net: stmmac: Make MDIO bus reset optional

The Tegra EQOS driver already resets the MDIO bus at probe time via the
reset GPIO specified in the phy-reset-gpios device tree property. There
is no need to reset the bus again later on.

This avoids the need to query the device tree for the snps,reset GPIO,
which is not part of the Tegra EQOS device tree bindings. This quiesces
an error message from the generic bus reset code if it doesn't find the
snps,reset related delays.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: neigh: remove redundant assignment to variable bucket
Colin Ian King [Fri, 26 Jul 2019 09:46:11 +0000 (10:46 +0100)]
net: neigh: remove redundant assignment to variable bucket

The variable bucket is being initialized with a value that is never
read and it is being updated later with a new value in a following
for-loop. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosis900: add support for ethtool's EEPROM dump
Sergej Benilov [Thu, 25 Jul 2019 19:48:06 +0000 (21:48 +0200)]
sis900: add support for ethtool's EEPROM dump

Implement ethtool's EEPROM dump command (ethtool -e|--eeprom-dump).

Thx to Andrew Lunn for comments.

Signed-off-by: Sergej Benilov <sergej.benilov@googlemail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agostaging: octeon: Fix build failure due to typo.
David S. Miller [Fri, 26 Jul 2019 21:10:30 +0000 (14:10 -0700)]
staging: octeon: Fix build failure due to typo.

drivers/staging/octeon/ethernet-tx.c:287:23: error: implicit declaration of function 'skb_drag_size'; did you mean 'skb_frag_size'? [-Werror=implicit-function-declaration]

From kernelci report:

https://kernelci.org/build/id/5d3943f859b514103f688918/logs/

Fixes: 92493a2f8a8d ("Build fixes for skb_frag_size conversion")
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mvneta: use devm_platform_ioremap_resource() to simplify code
Jisheng Zhang [Thu, 25 Jul 2019 07:48:04 +0000 (07:48 +0000)]
net: mvneta: use devm_platform_ioremap_resource() to simplify code

devm_platform_ioremap_resource() wraps platform_get_resource() and
devm_ioremap_resource() in a single helper, let's use that helper to
simplify the code.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'tipc-link-changeover-issues'
David S. Miller [Thu, 25 Jul 2019 22:55:47 +0000 (15:55 -0700)]
Merge branch 'tipc-link-changeover-issues'

Tuong Lien says:

====================
tipc: link changeover issues

This patch series is to resolve some issues found with the current link
changeover mechanism, it also includes an optimization for the link
synching.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotipc: fix changeover issues due to large packet
Tuong Lien [Wed, 24 Jul 2019 01:56:12 +0000 (08:56 +0700)]
tipc: fix changeover issues due to large packet

In conjunction with changing the interfaces' MTU (e.g. especially in
the case of a bonding) where the TIPC links are brought up and down
in a short time, a couple of issues were detected with the current link
changeover mechanism:

1) When one link is up but immediately forced down again, the failover
procedure will be carried out in order to failover all the messages in
the link's transmq queue onto the other working link. The link and node
state is also set to FAILINGOVER as part of the process. The message
will be transmited in form of a FAILOVER_MSG, so its size is plus of 40
bytes (= the message header size). There is no problem if the original
message size is not larger than the link's MTU - 40, and indeed this is
the max size of a normal payload messages. However, in the situation
above, because the link has just been up, the messages in the link's
transmq are almost SYNCH_MSGs which had been generated by the link
synching procedure, then their size might reach the max value already!
When the FAILOVER_MSG is built on the top of such a SYNCH_MSG, its size
will exceed the link's MTU. As a result, the messages are dropped
silently and the failover procedure will never end up, the link will
not be able to exit the FAILINGOVER state, so cannot be re-established.

2) The same scenario above can happen more easily in case the MTU of
the links is set differently or when changing. In that case, as long as
a large message in the failure link's transmq queue was built and
fragmented with its link's MTU > the other link's one, the issue will
happen (there is no need of a link synching in advance).

3) The link synching procedure also faces with the same issue but since
the link synching is only started upon receipt of a SYNCH_MSG, dropping
the message will not result in a state deadlock, but it is not expected
as design.

The 1) & 3) issues are resolved by the last commit that only a dummy
SYNCH_MSG (i.e. without data) is generated at the link synching, so the
size of a FAILOVER_MSG if any then will never exceed the link's MTU.

For the 2) issue, the only solution is trying to fragment the messages
in the failure link's transmq queue according to the working link's MTU
so they can be failovered then. A new function is made to accomplish
this, it will still be a TUNNEL PROTOCOL/FAILOVER MSG but if the
original message size is too large, it will be fragmented & reassembled
at the receiving side.

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agotipc: optimize link synching mechanism
Tuong Lien [Wed, 24 Jul 2019 01:56:11 +0000 (08:56 +0700)]
tipc: optimize link synching mechanism

This commit along with the next one are to resolve the issues with the
link changeover mechanism. See that commit for details.

Basically, for the link synching, from now on, we will send only one
single ("dummy") SYNCH message to peer. The SYNCH message does not
contain any data, just a header conveying the synch point to the peer.

A new node capability flag ("TIPC_TUNNEL_ENHANCED") is introduced for
backward compatible!

Acked-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Suggested-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoptp: ptp_dte: remove redundant dev_err message
Ding Xiang [Tue, 23 Jul 2019 08:54:05 +0000 (16:54 +0800)]
ptp: ptp_dte: remove redundant dev_err message

devm_ioremap_resource already contains error message, so remove
the redundant dev_err message

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Two-small-updates'
David S. Miller [Thu, 25 Jul 2019 18:36:19 +0000 (11:36 -0700)]
Merge branch 'mlxsw-Two-small-updates'

Ido Schimmel says:

====================
mlxsw: Two small updates

Patch #1, from Amit, exposes the size of the key-value database (KVD)
where different entries (e.g., routes, neighbours) are stored in the
device. This allows users to understand how many entries can be
offloaded and is also useful for writing scale tests.

Patch #2 increases the number of IPv6 nexthop groups mlxsw can offload.
The problem and solution are explained in detail in the commit message.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum_router: Increase scale of IPv6 nexthop groups
Ido Schimmel [Tue, 23 Jul 2019 07:57:42 +0000 (10:57 +0300)]
mlxsw: spectrum_router: Increase scale of IPv6 nexthop groups

Unlike IPv4, the kernel does not consolidate IPv6 nexthop groups. To
avoid exhausting the device's adjacency table - where nexthops are
stored - the driver does this consolidation instead.

Each nexthop group is hashed by XOR-ing the interface indexes of all the
member nexthop devices. However, the ifindex itself is not hashed, which
can result in identical keys used for different groups and finally an
-EBUSY error from rhashtable due to too long objects list.

Improve the situation by hashing the ifindex itself.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlxsw: spectrum: Expose KVD size for Spectrum-2
Amit Cohen [Tue, 23 Jul 2019 07:57:41 +0000 (10:57 +0300)]
mlxsw: spectrum: Expose KVD size for Spectrum-2

Unlike Spectrum-1, the KVD (Key-value database) of Spectrum-2 is not
partitioned, so only expose the entire KVD size. This enables users to
query the total size of the KVD.

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 agonet: sfc: falcon: convert to i2c_new_dummy_device
Wolfram Sang [Mon, 22 Jul 2019 17:26:35 +0000 (19:26 +0200)]
net: sfc: falcon: convert to i2c_new_dummy_device

Move from i2c_new_dummy() to i2c_new_dummy_device(). So, we now get an
ERRPTR which we use in error handling.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agomlx4: avoid large stack usage in mlx4_init_hca()
Arnd Bergmann [Mon, 22 Jul 2019 15:01:55 +0000 (17:01 +0200)]
mlx4: avoid large stack usage in mlx4_init_hca()

The mlx4_dev_cap and mlx4_init_hca_param are really too large
to be put on the kernel stack, as shown by this clang warning:

drivers/net/ethernet/mellanox/mlx4/main.c:3304:12: error: stack frame size of 1088 bytes in function 'mlx4_load_one' [-Werror,-Wframe-larger-than=]

With gcc, the problem is the same, but it does not warn because
it does not inline this function, and therefore stays just below
the warning limit, while clang is just above it.

Use kzalloc for dynamic allocation instead of putting them
on stack. This gets the combined stack frame down to 424 bytes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqed: reduce maximum stack frame size
Arnd Bergmann [Mon, 22 Jul 2019 15:01:23 +0000 (17:01 +0200)]
qed: reduce maximum stack frame size

clang warns about an overly large stack frame in one function
when it decides to inline all __qed_get_vport_*() functions into
__qed_get_vport_stats():

drivers/net/ethernet/qlogic/qed/qed_l2.c:1889:13: error: stack frame size of 1128 bytes in function '_qed_get_vport_stats' [-Werror,-Wframe-larger-than=]

Use a noinline_for_stack annotation to prevent clang from inlining
these, which keeps the maximum stack usage at around half of that
in the worst case, similar to what we get with gcc.

Fixes: 86622ee75312 ("qed: Move statistics to L2 code")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: improve rtl_set_rx_mode
Heiner Kallweit [Wed, 24 Jul 2019 21:34:45 +0000 (23:34 +0200)]
r8169: improve rtl_set_rx_mode

This patch improves and simplifies rtl_set_rx_mode a little.
No functional change intended.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next...
David S. Miller [Wed, 24 Jul 2019 22:35:40 +0000 (15:35 -0700)]
Merge branch '1GbE' of git://git./linux/kernel/git/jkirsher/next-queue

Jeff Kirsher says:

====================
1GbE Intel Wired LAN Driver Updates 2019-07-24

This series contains updates to igc and e1000e client drivers only.

Sasha provides a couple of cleanups to remove code that is not needed
and reduce structure sizes.  Updated the MAC reset flow to use the
device reset flow instead of a port reset flow.  Added addition device
id's that will be supported.

Kai-Heng Feng provides a workaround for a possible stalled packet issue
in our ICH devices due to a clock recovery from the PCH being too slow.

v2: removed the last patch in the series that supposedly fixed a MAC/PHY
    de-sync potential issue while waiting for additional information from
    hardware engineers.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/ixgbevf: fix a compilation error of skb_frag_t
Qian Cai [Wed, 24 Jul 2019 16:17:59 +0000 (12:17 -0400)]
net/ixgbevf: fix a compilation error of skb_frag_t

The linux-next commit "net: Rename skb_frag_t size to bv_len" [1]
introduced a compilation error on powerpc as it forgot to deal with the
renaming from "size" to "bv_len" for ixgbevf.

[1] https://lore.kernel.org/netdev/20190723030831.11879-1-willy@infradead.org/T/#md052f1c7de965ccd1bdcb6f92e1990a52298eac5

In file included from ./include/linux/cache.h:5,
                 from ./include/linux/printk.h:9,
                 from ./include/linux/kernel.h:15,
                 from ./include/linux/list.h:9,
                 from ./include/linux/module.h:9,
                 from
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:12:
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c: In function
'ixgbevf_xmit_frame_ring':
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4138:51: error:
'skb_frag_t' {aka 'struct bio_vec'} has no member named 'size'
   count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size);
                                                   ^
./include/uapi/linux/kernel.h:13:40: note: in definition of macro
'__KERNEL_DIV_ROUND_UP'
 #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
                                        ^
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c:4138:12: note: in
expansion of macro 'TXD_USE_COUNT'
   count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size);

Signed-off-by: Qian Cai <cai@lca.pw>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: mlxsw: Fix typo in qos_mc_aware.sh
Masanari Iida [Wed, 24 Jul 2019 15:29:51 +0000 (00:29 +0900)]
selftests: mlxsw: Fix typo in qos_mc_aware.sh

This patch fix some spelling typo in qos_mc_aware.sh

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqlge: Fix build error without CONFIG_ETHERNET
YueHaibing [Wed, 24 Jul 2019 13:01:26 +0000 (21:01 +0800)]
qlge: Fix build error without CONFIG_ETHERNET

Now if CONFIG_ETHERNET is not set, QLGE driver
building fails:

drivers/staging/qlge/qlge_main.o: In function `qlge_remove':
drivers/staging/qlge/qlge_main.c:4831: undefined reference to `unregister_netdev'

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 955315b0dc8c ("qlge: Move drivers/net/ethernet/qlogic/qlge/ to drivers/staging/qlge/")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agor8169: fix a typo in a comment
Corentin Musard [Wed, 24 Jul 2019 12:34:43 +0000 (14:34 +0200)]
r8169: fix a typo in a comment

Replace "additonal" by "additional" in a comment.
Typo found by checkpatch.pl.

Signed-off-by: Corentin Musard <corentinmusard@gmail.com>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoe1000e: add workaround for possible stalled packet
Kai-Heng Feng [Mon, 8 Jul 2019 04:55:45 +0000 (12:55 +0800)]
e1000e: add workaround for possible stalled packet

This works around a possible stalled packet issue, which may occur due to
clock recovery from the PCH being too slow, when the LAN is transitioning
from K1 at 1G link speed.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204057

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Add more SKUs for i225 device
Sasha Neftin [Tue, 2 Jul 2019 11:39:55 +0000 (14:39 +0300)]
igc: Add more SKUs for i225 device

Add support for more SKUs.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Update the MAC reset flow
Sasha Neftin [Wed, 26 Jun 2019 05:53:47 +0000 (08:53 +0300)]
igc: Update the MAC reset flow

Use Device Reset flow instead of Port Reset flow.
This flow performs a reset of the entire controller device,
resulting in a state nearly approximating the state
following a power-up reset or internal PCIe reset,
except for system PCI configuration.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Remove the unused field from a device specification structure
Sasha Neftin [Sun, 23 Jun 2019 10:42:32 +0000 (13:42 +0300)]
igc: Remove the unused field from a device specification structure

This patch comes to clean up the device specification structure.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoigc: Remove the polarity field from a PHY information structure
Sasha Neftin [Sun, 23 Jun 2019 10:42:31 +0000 (13:42 +0300)]
igc: Remove the polarity field from a PHY information structure

Polarity and cable length fields is not applicable for the i225 device.
This patch comes to clean up PHY information structure.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
4 years agoBuild fixes for skb_frag_size conversion
Matthew Wilcox (Oracle) [Wed, 24 Jul 2019 11:36:15 +0000 (04:36 -0700)]
Build fixes for skb_frag_size conversion

I missed a few places.  One is in some ifdeffed code which will probably
never be re-enabled; the others are in drivers which can't currently be
compiled on x86.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc-falcon: Use dev_get_drvdata where possible
Chuhong Yuan [Wed, 24 Jul 2019 11:27:06 +0000 (19:27 +0800)]
sfc-falcon: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agosfc: Use dev_get_drvdata where possible
Chuhong Yuan [Wed, 24 Jul 2019 11:26:58 +0000 (19:26 +0800)]
sfc: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoforcedeth: Use dev_get_drvdata where possible
Chuhong Yuan [Wed, 24 Jul 2019 11:26:48 +0000 (19:26 +0800)]
forcedeth: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: marvell: Use dev_get_drvdata where possible
Chuhong Yuan [Wed, 24 Jul 2019 11:26:34 +0000 (19:26 +0800)]
net: marvell: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge tag 'linux-can-next-for-5.4-20190724' of git://git.kernel.org/pub/scm/linux...
David S. Miller [Wed, 24 Jul 2019 18:36:24 +0000 (11:36 -0700)]
Merge tag 'linux-can-next-for-5.4-20190724' of git://git./linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2019-07-24

this is a pull request for net-next/master consisting of 26 patches.

The first two patches are by me. One adds missing files of the CAN
subsystem to the MAINTAINERS file, while the other sorts the
Makefile/Kconfig of the sja1000 drivers sub directory. In the next patch
Ji-Ze Hong (Peter Hong) provides a driver for the "Fintek PCIE to 2 CAN"
controller, based on the the sja1000 IP core.

Gustavo A. R. Silva's patch for the kvaser_usb driver introduces the use
of struct_size() instead of open coding it. Henning Colliander's patch
adds a driver for the "Kvaser PCIEcan" devices.

Another patch by Gustavo A. R. Silva marks expected switch fall-throughs
properly.

Dan Murphy provides 5 patches for the m_can. After cleanups a framework
is introduced so that the driver can be used from memory mapped IO as
well as SPI attached devices. Finally he adds a driver for the tcan4x5x
which uses this framework.

A series of 5 patches by Appana Durga Kedareswara rao for the xilinx_can
driver, first clean up,then add support for CANFD. Colin Ian King
contributes another cleanup for the xilinx_can driver.

Robert P. J. Day's patch corrects the brief history of the CAN protocol
given in the Kconfig menu entry.

2 patches by Dong Aisheng for the flexcan driver provide PE clock source
select support and dt-bindings description.
2 patches by Sean Nyekjaer for the flexcan driver provide add CAN
wakeup-source property and dt-bindings description.

Jeroen Hofstee's patch converts the ti_hecc driver to make use of the
rx-offload helper fixing a number of outstanding bugs.

The first patch of Oliver Hartkopp removes the now obsolete empty
ioctl() handler for the CAN protocols. The second patch adds SPDX
license identifiers for CAN subsystem.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodrivers: net: xgene: Remove acpi_has_method() calls
Kelsey Skunberg [Wed, 24 Jul 2019 06:06:59 +0000 (00:06 -0600)]
drivers: net: xgene: Remove acpi_has_method() calls

acpi_evaluate_object will already return an error if the needed method
does not exist. Remove unnecessary acpi_has_method() calls and check the
returned acpi_status for failure instead.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agocan: Add SPDX license identifiers for CAN subsystem
Oliver Hartkopp [Tue, 23 Jul 2019 13:17:55 +0000 (15:17 +0200)]
can: Add SPDX license identifiers for CAN subsystem

Add missing SPDX identifiers for the CAN network layer and correct the SPDX
license for two of its include files to make sure the BSD-3-Clause applies
for the entire subsystem.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: remove obsolete empty ioctl() handler
Oliver Hartkopp [Tue, 23 Jul 2019 12:08:47 +0000 (14:08 +0200)]
can: remove obsolete empty ioctl() handler

With commit c7cbdbf29f488a ("net: rework SIOCGSTAMP ioctl handling") the only
ioctl function in can_ioctl() has been removed.

As this SIOCGSTAMP ioctl command is now handled in net/socket.c we can entirely
remove the CAN specific ioctl functions.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: ti_hecc: use timestamp based rx-offloading
Jeroen Hofstee [Mon, 29 Apr 2019 12:03:32 +0000 (12:03 +0000)]
can: ti_hecc: use timestamp based rx-offloading

As already mentioned in [1] and included in [2], there is an off by one
issue since the high bank is already enabled when the _next_ mailbox to
be read has index 12, so the mailbox being read was 13. The message can
therefore go into mailbox 31 and the driver will be repolled until the
mailbox 12 eventually receives a msg. Or the message might end up in the
12th mailbox, but then it would become disabled after reading it and only
be enabled again in the next "round" after mailbox 13 was read, which can
cause out of order messages, since the lower priority mailboxes can
accept messages in the meantime.

As mentioned in [3] there is a hardware race condition when changing the
CANME register while messages are being received. Even when including a
busy poll on reception, like in [2] there are still overflows and out of
order messages at times, but less then without the busy loop polling.
Unlike what the patch suggests, the polling time is not in the microsecond
range, but takes as long as a current CAN bus reception needs to finish,
so typically more in the fraction of millisecond range. Since the timeout
is in jiffies it won't timeout.

Even with these additional fixes the driver is still not able to provide a
proper FIFO which doesn't drop packages. So change the driver to use
rx-offload and base order on timestamp instead of message box numbers. As
a side affect, this also fixes [4] and [5].

Before this change messages with a single byte counter were dropped /
received out of order at a bitrate of 250kbit/s on an am3517. With this
patch that no longer occurs up to and including 1Mbit/s.

[1] https://linux-can.vger.kernel.narkive.com/zgO9inVi/patch-can-ti-hecc-fix-rx-wrong-sequence-issue#post6
[2] http://arago-project.org/git/projects/?p=linux-omap3.git;a=commit;h=02346892777f07245de4d5af692513ebd852dcb2
[3] https://linux-can.vger.kernel.narkive.com/zgO9inVi/patch-can-ti-hecc-fix-rx-wrong-sequence-issue#post5
[4] https://patchwork.ozlabs.org/patch/895956/
[5] https://www.spinics.net/lists/netdev/msg494971.html

Cc: Anant Gole <anantgole@ti.com>
Cc: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: flexcan: add support for DT property 'wakeup-source'
Sean Nyekjaer [Tue, 9 Apr 2019 08:39:48 +0000 (10:39 +0200)]
can: flexcan: add support for DT property 'wakeup-source'

The flexcan controller can be forced as a wakeup source by
stating that explicitly in the device's .dts file using the
"wakeup-source" boolean property.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agodt-bindings: can: flexcan: add can wakeup property
Sean Nyekjaer [Tue, 9 Apr 2019 08:39:49 +0000 (10:39 +0200)]
dt-bindings: can: flexcan: add can wakeup property

This patch adds the wakeup-source boolean property.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: flexcan: add support for PE clock source select
Dong Aisheng [Thu, 13 Dec 2018 07:08:00 +0000 (07:08 +0000)]
can: flexcan: add support for PE clock source select

Add support to select the clock source for CAN Protocol Engine (PE).
It's SoC Implementation dependent. Refer to RM for detailed definition
of each SoC. We select clock source 1 (peripheral clock) by default in
driver now, this patch adds support to parse the clock source from the DT.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agodt-bindings: can: flexcan: add PE clock source property to device tree
Dong Aisheng [Thu, 13 Dec 2018 07:07:57 +0000 (07:07 +0000)]
dt-bindings: can: flexcan: add PE clock source property to device tree

The FlexCAN controller can parse clock source property from DTS file to
select PE clock source.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: flexcan: implement can Runtime PM
Aisheng Dong [Fri, 30 Nov 2018 08:53:26 +0000 (08:53 +0000)]
can: flexcan: implement can Runtime PM

Flexcan will be disabled during suspend if no wakeup function required and
enabled after resume accordingly. During this period, we could explicitly
disable clocks.
Since PM is optional, the clock is enabled at probe to guarante the
clock is running when PM is not enabled in the kernel.

Implement Runtime PM which will:
1) Without CONFIG_PM, clock is running whether Flexcan up or down.
2) With CONFIG_PM, clock enabled while Flexcan up and disabled when
   Flexcan down.
3) Disable clock when do system suspend and enable clock while system
   resume.
4) Make Power Domain framework be able to shutdown the corresponding
   power domain of this device.

Signed-off-by: Aisheng Dong <aisheng.dong@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: Kconfig: correct history of the CAN protocol
Robert P. J. Day [Wed, 12 Jun 2019 15:48:56 +0000 (11:48 -0400)]
can: Kconfig: correct history of the CAN protocol

Current history of CAN protocol is wrong, fix it in the Kconfig file.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: xilinx_can: clean up indentation issue
Colin Ian King [Wed, 19 Jun 2019 16:45:17 +0000 (17:45 +0100)]
can: xilinx_can: clean up indentation issue

A statement is indented one level too deep, fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: xilinx_can: Add support for CANFD FD frames
Appana Durga Kedareswara rao [Mon, 18 Mar 2019 11:32:44 +0000 (17:02 +0530)]
can: xilinx_can: Add support for CANFD FD frames

CANFD IP supports both CAN and CAN FD frames,
Existing driver supports only CAN frames, This patch
adds support for CAN FD frames.

Signed-off-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: xilinx_can: Add cantype parameter in xcan_devtype_data struct
Appana Durga Kedareswara rao [Mon, 18 Mar 2019 11:32:43 +0000 (17:02 +0530)]
can: xilinx_can: Add cantype parameter in xcan_devtype_data struct

To differentiate between different CAN IP's this patch adds
cantype enum variable in the xcan_devtype_data structure

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: xilinx_can: Fix flags field initialization for axi can and canps
Appana Durga Kedareswara rao [Mon, 18 Mar 2019 11:32:42 +0000 (17:02 +0530)]
can: xilinx_can: Fix flags field initialization for axi can and canps

AXI CAN IP and CANPS IP supports tx fifo empty feature, this patch updates
the flags field for the same.

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: xilinx_can: Fix kernel doc warnings
Appana Durga Kedareswara rao [Mon, 18 Mar 2019 11:32:46 +0000 (17:02 +0530)]
can: xilinx_can: Fix kernel doc warnings

This patch fixes below kernel doc warnings
warning: Function parameter or member 'priv' not described in
'xcan_write_frame'
warning: Function parameter or member 'skb' not described in
'xcan_start_xmit_fifo'
warning: Function parameter or member 'ndev' not described in
'xcan_start_xmit_fifo'
warning: Function parameter or member 'skb' not described in
'xcan_start_xmit_mailbox'
warning: Function parameter or member 'ndev' not described in
'xcan_start_xmit_mailbox'
warning: Function parameter or member 'priv' not described in
'xcan_rx_fifo_get_next_frame'

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: xilinx_can: Fix style issues
Appana Durga Kedareswara rao [Mon, 18 Mar 2019 11:32:41 +0000 (17:02 +0530)]
can: xilinx_can: Fix style issues

This patch fixes below checkpatch warnings and checks in the driver.

CHECK: Alignment should match open parenthesis
+       void (*write_reg)(const struct xcan_priv *priv, enum xcan_reg reg,
+                       u32 val);

CHECK: Alignment should match open parenthesis
+static void xcan_write_reg_le(const struct xcan_priv *priv, enum xcan_reg reg,
+                       u32 val)

CHECK: Alignment should match open parenthesis
+static void xcan_write_reg_be(const struct xcan_priv *priv, enum xcan_reg reg,
+                       u32 val)

CHECK: Alignment should match open parenthesis
+       netdev_dbg(ndev, "BRPR=0x%08x, BTR=0x%08x\n",
+                       priv->read_reg(priv, XCAN_BRPR_OFFSET),

CHECK: Alignment should match open parenthesis
+                       netdev_warn(ndev,
+                               "timed out for correct mode\n");

CHECK: Alignment should match open parenthesis
+       netdev_dbg(ndev, "status:#x%08x\n",
+                       priv->read_reg(priv, XCAN_SR_OFFSET));

CHECK: spaces preferred around that '-' (ctx:VxV)
+                       (CAN_EFF_ID_BITS-CAN_SFF_ID_BITS)) <<
                                        ^

CHECK: Alignment should match open parenthesis
+       netdev_dbg(ndev, "%s: error status register:0x%x\n",
+                       __func__, priv->read_reg(priv, XCAN_ESR_OFFSET));

WARNING: line over 80 characters
+                       offset = XCAN_RXMSG_2_FRAME_OFFSET(fsr & XCAN_FSR_RI_MASK);

WARNING: line over 80 characters
+                       offset = XCAN_RXMSG_FRAME_OFFSET(fsr & XCAN_FSR_RI_MASK);

WARNING: line over 80 characters
+               while ((isr & XCAN_IXR_TXOK_MASK) && !WARN_ON(++retries == 100)) {

WARNING: line over 80 characters
+                       priv->write_reg(priv, XCAN_ICR_OFFSET, XCAN_IXR_TXOK_MASK);

CHECK: Alignment should match open parenthesis
+               netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
+                               __func__, ret);

CHECK: Alignment should match open parenthesis
+       ret = request_irq(ndev->irq, xcan_interrupt, priv->irq_flags,
+                       ndev->name, ndev);

CHECK: Alignment should match open parenthesis
+static int xcan_get_berr_counter(const struct net_device *ndev,
+                                       struct can_berr_counter *bec)

CHECK: Alignment should match open parenthesis
+               netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
+                               __func__, ret);

CHECK: Please don't use multiple blank lines
+
+

CHECK: Alignment should match open parenthesis
+               netdev_err(ndev, "%s: pm_runtime_get failed(%d)\n",
+                       __func__, ret);`

Signed-off-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: tcan4x5x: Add tcan4x5x driver to the kernel
Dan Murphy [Thu, 9 May 2019 16:11:08 +0000 (11:11 -0500)]
can: tcan4x5x: Add tcan4x5x driver to the kernel

Add the TCAN4x5x SPI CAN driver.

This device uses the Bosch MCAN IP core along with a SPI interface map.
Register to the MCAN common core code to manage the MCAN IP.

This device has a special method to indicate a write/read operation on
the data payload.

Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agodt-bindings: can: tcan4x5x: Add DT bindings for TCAN4x5X driver
Dan Murphy [Thu, 9 May 2019 16:11:07 +0000 (11:11 -0500)]
dt-bindings: can: tcan4x5x: Add DT bindings for TCAN4x5X driver

DT binding documentation for TI TCAN4x5x driver.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: m_can: Rename m_can_priv to m_can_classdev
Dan Murphy [Thu, 9 May 2019 16:11:06 +0000 (11:11 -0500)]
can: m_can: Rename m_can_priv to m_can_classdev

Rename the common m_can_priv class structure to m_can_classdev as this
is more descriptive.

Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: m_can: Create a m_can platform framework
Dan Murphy [Thu, 9 May 2019 16:11:05 +0000 (11:11 -0500)]
can: m_can: Create a m_can platform framework

Create a m_can platform framework that peripheral
devices can register to and use common code and register sets.
The peripheral devices may provide read/write and configuration
support of the IP.

Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: m_can: Fix checkpatch issues on existing code
Dan Murphy [Thu, 9 May 2019 16:11:09 +0000 (11:11 -0500)]
can: m_can: Fix checkpatch issues on existing code

Fix checkpatch issues found during the m_can framework creation, before
framework creation in the following patches.

Fix these 4 check issues:
CHECK: Unnecessary parentheses around 'cdev->can.state != CAN_STATE_ERROR_WARNING'
if (psr & PSR_EW &&
    (cdev->can.state != CAN_STATE_ERROR_WARNING)) {

CHECK: Unnecessary parentheses around 'cdev->can.state != CAN_STATE_ERROR_PASSIVE'
if ((psr & PSR_EP) &&
    (cdev->can.state != CAN_STATE_ERROR_PASSIVE)) {

CHECK: Unnecessary parentheses around 'cdev->can.state != CAN_STATE_BUS_OFF'
if ((psr & PSR_BO) &&
    (cdev->can.state != CAN_STATE_BUS_OFF)) {

CHECK: Unnecessary parentheses around 'priv->version <= 31'
if ((priv->version <= 31) && (irqstatus & IR_MRAF) &&
    (m_can_read(priv, M_CAN_ECR) & ECR_RP)) {

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: mark expected switch fall-throughs
Gustavo A. R. Silva [Tue, 29 Jan 2019 18:06:12 +0000 (12:06 -0600)]
can: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

This patch fixes the following warnings:

drivers/net/can/peak_canfd/peak_pciefd_main.c:668:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/can/spi/mcp251x.c:875:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/can/usb/peak_usb/pcan_usb.c:422:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/can/at91_can.c:895:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/can/at91_can.c:953:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
drivers/net/can/usb/peak_usb/pcan_usb.c: In function ‘pcan_usb_decode_error’:
drivers/net/can/usb/peak_usb/pcan_usb.c:422:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (n & PCAN_USB_ERROR_BUS_LIGHT) {
      ^
drivers/net/can/usb/peak_usb/pcan_usb.c:428:2: note: here
  case CAN_STATE_ERROR_WARNING:
  ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enabling
-Wimplicit-fallthrough.

Notice that in some cases spelling mistakes were fixed.
In other cases, the /* fall through */ comment is placed
at the bottom of the case statement, which is what GCC
is expecting to find.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> # for the at91_can.c
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: kvaser_pciefd: Add driver for Kvaser PCIEcan devices
Henning Colliander [Tue, 28 May 2019 12:48:21 +0000 (14:48 +0200)]
can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices

This patch adds support for Kvaser PCIEcan devices. This includes
support for up to 4 CAN channels on a single card, depending on device.

Signed-off-by: Henning Colliander <henning.colliander@evidente.se>
Signed-off-by: Jimmy Assarsson <extja@kvaser.com>
Signed-off-by: Christer Beskow <chbe@kvaser.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: kvaser_usb: Use struct_size() in alloc_candev()
Gustavo A. R. Silva [Fri, 8 Feb 2019 03:10:35 +0000 (21:10 -0600)]
can: kvaser_usb: Use struct_size() in alloc_candev()

One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
    int stuff;
    void *entry[];
};

instance = alloc(sizeof(struct foo) + count * sizeof(void *));

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = alloc(struct_size(instance, entry, count));

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: sja1000: f81601: add Fintek F81601 support
Ji-Ze Hong (Peter Hong) [Tue, 23 Jul 2019 09:03:06 +0000 (17:03 +0800)]
can: sja1000: f81601: add Fintek F81601 support

This patch add support for Fintek PCIE to 2 CAN controller support

Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agocan: sja1000: Makefile/Kconfig: sort alphabetically
Marc Kleine-Budde [Mon, 22 Jul 2019 09:36:08 +0000 (11:36 +0200)]
can: sja1000: Makefile/Kconfig: sort alphabetically

This patch sorts the drivers in the Makefile alphabetically and arranges
the Kconfig file accordingly.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agoMAINTAINERS: can: add missing files to CAN NETWORK DRIVERS and CAN NETWORK LAYER
Marc Kleine-Budde [Mon, 1 Jul 2019 13:42:46 +0000 (15:42 +0200)]
MAINTAINERS: can: add missing files to CAN NETWORK DRIVERS and CAN NETWORK LAYER

This patch adds missing files to the CAN NETWORK DRIVERS and CAN NETWORK
LAYER entry.

Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
4 years agotc-testing: added tdc tests for [b|p]fifo qdisc
Roman Mashak [Tue, 23 Jul 2019 19:01:59 +0000 (15:01 -0400)]
tc-testing: added tdc tests for [b|p]fifo qdisc

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agohv_sock: Use consistent types for UUIDs
Andy Shevchenko [Tue, 23 Jul 2019 16:39:43 +0000 (19:39 +0300)]
hv_sock: Use consistent types for UUIDs

The rest of Hyper-V code is using new types for UUID handling.
Convert hv_sock as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'nfp-Offload-MPLS-actions'
David S. Miller [Tue, 23 Jul 2019 20:52:51 +0000 (13:52 -0700)]
Merge branch 'nfp-Offload-MPLS-actions'

John Hurley says:

====================
nfp: Offload MPLS actions

The module act_mpls has recently been added to the kernel. This allows the
manipulation of MPLS headers on packets including push, pop and modify.
Add these new actions and parameters to the intermediate representation
API for hardware offload. Follow this by implementing the offload of these
MPLS actions in the NFP driver.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: flower: offload MPLS set action
John Hurley [Tue, 23 Jul 2019 14:34:02 +0000 (15:34 +0100)]
nfp: flower: offload MPLS set action

Recent additions to the kernel include a TC action module to manipulate
MPLS headers on packets. Such actions are available to offload via the
flow_offload intermediate representation API.

Modify the NFP driver to allow the offload of MPLS set actions to
firmware. Set actions update the outermost MPLS header. The offload
includes a mask to specify which fields should be set.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: flower: offload MPLS pop action
John Hurley [Tue, 23 Jul 2019 14:34:01 +0000 (15:34 +0100)]
nfp: flower: offload MPLS pop action

Recent additions to the kernel include a TC action module to manipulate
MPLS headers on packets. Such actions are available to offload via the
flow_offload intermediate representation API.

Modify the NFP driver to allow the offload of MPLS pop actions to
firmware. The act_mpls TC module enforces that the next protocol is
supplied along with the pop action. Passing this to firmware allows it
to properly rebuild the underlying packet after the pop.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonfp: flower: offload MPLS push action
John Hurley [Tue, 23 Jul 2019 14:34:00 +0000 (15:34 +0100)]
nfp: flower: offload MPLS push action

Recent additions to the kernel include a TC action module to manipulate
MPLS headers on packets. Such actions are available to offload via the
flow_offload intermediate representation API.

Modify the NFP driver to allow the offload of MPLS push actions to
firmware.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: sched: include mpls actions in hardware intermediate representation
John Hurley [Tue, 23 Jul 2019 14:33:59 +0000 (15:33 +0100)]
net: sched: include mpls actions in hardware intermediate representation

A recent addition to TC actions is the ability to manipulate the MPLS
headers on packets.

In preparation to offload such actions to hardware, update the IR code to
accept and prepare the new actions.

Note that no driver currently impliments the MPLS dec_ttl action so this
is not included.

Signed-off-by: John Hurley <john.hurley@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/mlx5e: xsk: dynamically allocate mlx5e_channel_param
Arnd Bergmann [Tue, 23 Jul 2019 12:02:26 +0000 (12:02 +0000)]
net/mlx5e: xsk: dynamically allocate mlx5e_channel_param

The structure is too large to put on the stack, resulting in a
warning on 32-bit ARM:

drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c:59:5: error: stack frame size of 1344 bytes in function
      'mlx5e_open_xsk' [-Werror,-Wframe-larger-than=]

Use kvzalloc() instead.

Fixes: a038e9794541 ("net/mlx5e: Add XSK zero-copy support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: jme: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 14:16:42 +0000 (22:16 +0800)]
net: jme: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoigb: Use dev_get_drvdata where possible
Chuhong Yuan [Tue, 23 Jul 2019 14:16:24 +0000 (22:16 +0800)]
igb: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoi40e: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 14:15:51 +0000 (22:15 +0800)]
i40e: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agofm10k: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 14:15:33 +0000 (22:15 +0800)]
fm10k: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoe1000e: Use dev_get_drvdata where possible
Chuhong Yuan [Tue, 23 Jul 2019 14:15:13 +0000 (22:15 +0800)]
e1000e: Use dev_get_drvdata where possible

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: broadcom: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 13:19:29 +0000 (21:19 +0800)]
net: broadcom: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: atheros: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 13:18:56 +0000 (21:18 +0800)]
net: atheros: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: 3com: 3c59x: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 13:18:44 +0000 (21:18 +0800)]
net: 3com: 3c59x: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoatm: Use dev_get_drvdata
Chuhong Yuan [Tue, 23 Jul 2019 08:13:14 +0000 (16:13 +0800)]
atm: Use dev_get_drvdata

Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoftgmac100: Fix build.
David S. Miller [Tue, 23 Jul 2019 18:45:44 +0000 (11:45 -0700)]
ftgmac100: Fix build.

drivers/net/ethernet/faraday/ftgmac100.c:777:13: error: 'skb_frag_t {aka struct bio_vec}' has no member named 'size'

Fallout from the skb_frag_t conversion to bio_vec, simply
use skb_frag_size().

Fixes: b8b576a16f79 ("net: Rename skb_frag_t size to bv_len")
Reported-by: René van Dorst <opensource@vdorst.com>
Signed-off-by: David S. Miller <davem@davemloft.net>