platform/kernel/linux-starfive.git
4 years agonet: hns3: remove unused code in hns3_self_test()
Guojia Liao [Tue, 29 Sep 2020 09:32:03 +0000 (17:32 +0800)]
net: hns3: remove unused code in hns3_self_test()

NETIF_F_HW_VLAN_CTAG_FILTER is not set in netdev->hw_feature,
but set in netdev->features.

So the handler of NETIF_F_HW_VLAN_CTAG_FILTER in hns3_self_test() is
always true, remove it.

Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: Add RoCE VF reset support
Huazhong Tan [Tue, 29 Sep 2020 09:32:02 +0000 (17:32 +0800)]
net: hns3: Add RoCE VF reset support

Add RoCE VF client reset support by notifying the RoCE VF client
when hns3 VF is resetting and adding a interface to query whether
CMDQ is ready to work.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: add UDP segmentation offload support
Huazhong Tan [Tue, 29 Sep 2020 09:32:01 +0000 (17:32 +0800)]
net: hns3: add UDP segmentation offload support

Add support for UDP segmentation offload to the HNS3 driver
when the device can do it.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: rename trace event hns3_over_8bd
Huazhong Tan [Tue, 29 Sep 2020 09:32:00 +0000 (17:32 +0800)]
net: hns3: rename trace event hns3_over_8bd

Since the maximun BD number may not be 8 now, so rename
hns3_over_8bd() to hns3_over_max_bd().

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: hns3: replace macro HNS3_MAX_NON_TSO_BD_NUM
Huazhong Tan [Tue, 29 Sep 2020 09:31:59 +0000 (17:31 +0800)]
net: hns3: replace macro HNS3_MAX_NON_TSO_BD_NUM

Currently, the driver is able to query the device's specifications,
which includes the maximum BD number of non TSO packet, so replace
macro HNS3_MAX_NON_TSO_BD_NUM with the queried value, and rewrite
macro HNS3_MAX_NON_TSO_SIZE whose value depends on the the maximum
BD number of non TSO packet.

Also, add a new parameter max_non_tso_bd_num to function
hns3_tx_bd_num() and hns3_skb_need_linearized(), then they can get
the maximum BD number of non TSO packet from the caller instead of
calculating by themself, The note of hns3_skb_need_linearized()
should be update as well.

Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'octeontx2-af-cleanup-and-extend-parser-config'
David S. Miller [Tue, 29 Sep 2020 20:12:03 +0000 (13:12 -0700)]
Merge branch 'octeontx2-af-cleanup-and-extend-parser-config'

Stanislaw Kardach says:

====================
octeontx2-af: cleanup and extend parser config

Current KPU configuration data is spread over multiple files which makes
it hard to read. Clean this up by gathering all configuration data in a
single structure and also in a single file (npc_profile.h). This should
increase the readability of KPU handling code (since it always
references same structure), simplify updates to the CAM key extraction
code and allow abstracting out the configuration source.
Additionally extend and fix the parser config to support additional DSA
types, NAT-T-ESP and IPv6 fields.

Patch 1 ensures that CUSTOMx LTYPEs are not aliased with meaningful
LTYPEs where possible.

Patch 2 gathers all KPU profile related data into a single struct and
creates an adapter structure which provides an interface to the KPU
profile for the octeontx2-af driver.

Patches 3-4 add support for Extended DSA, eDSA and Forward DSA.

Patches 5-6 adds IPv6 fields to CAM key extraction and optimize the
parser performance for fragmented IPv6 packets.

Patch 7 refactors ESP handling in the parser to support NAT-T-ESP.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: add parser support for NAT-T-ESP
Kiran Kumar K [Tue, 29 Sep 2020 09:28:20 +0000 (11:28 +0200)]
octeontx2-af: add parser support for NAT-T-ESP

Add support for NAT-T-ESP to KPU parser configuration. NAT ESP is a UDP
based protocol. So move ESP to LE so that both UDP and ESP can be
extracted.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: optimize parsing of IPv6 fragments
Abhijit Ayarekar [Tue, 29 Sep 2020 09:28:19 +0000 (11:28 +0200)]
octeontx2-af: optimize parsing of IPv6 fragments

IPv6 fragmented packet may not contain completed layer 4 information.
So stop KPU parsing after setting ipv6 fragmentation flag.

Signed-off-by: Abhijit Ayarekar <aayarekar@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: Add IPv6 fields to default MKEX
Vidhya Vidhyaraman [Tue, 29 Sep 2020 09:28:18 +0000 (11:28 +0200)]
octeontx2-af: Add IPv6 fields to default MKEX

Added some IPv6 protocol fields to the default MKEX profile.
They include everything from the beginning of IP header and up to
source address. The pattern occupies full KW2 in MCAM entry.
Only one out of two LD registers for this protocol is used.

Signed-off-by: Vidhya Vidhyaraman <vraman@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: fix Extended DSA and eDSA parsing
Satha Rao [Tue, 29 Sep 2020 09:28:17 +0000 (11:28 +0200)]
octeontx2-af: fix Extended DSA and eDSA parsing

KPU profile interpret Extended DSA and eDSA by looking source dev. This
was incorrect and it restricts to use few source device ids and also
created confusion while parsing regular DSA tag. With below patch lookup
was based on bit 12 of Word0. This is always zero for DSA tag and it
should be one for Extended DSA and eDSA.

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: add parser support for Forward DSA
Hariprasad Kelam [Tue, 29 Sep 2020 09:28:16 +0000 (11:28 +0200)]
octeontx2-af: add parser support for Forward DSA

Marvell Prestera switches supports distributed switch architecture
by inserting Forward DSA tag of 4 bytes right after ethernet SMAC.
This tag don't have a tpid field.

This patch provides parser and extraction support for the same.
Default ldata extraction profile added for FDSA such that Src_port
is extracted and placed inplace of vlanid field. Like extended DSA
and eDSA tags,a special PKIND of 62 is used for this tag.

Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: cleanup KPU config data
Stanislaw Kardach [Tue, 29 Sep 2020 09:28:15 +0000 (11:28 +0200)]
octeontx2-af: cleanup KPU config data

Refactor KPU related NPC code gathering all configuration data in a
structured format and putting it in one place (npc_profile.h).
This increases readability and makes it easier to extend the profile
configuration (as opposed to jumping between multiple header and source
files).

To do this:
* Gather all KPU profile related data into a single adapter struct.
* Convert the built-in MKEX definition to a structured one to streamline
  the MKEX loading.
* Convert LT default register configuration into a structure, keeping
  default protocol settings in same file where identifiers for those
  protocols are defined.
* Add a single point for KPU profile loading, so that its source may
  change in the future once proper interfaces for loading such config
  are in place.

Signed-off-by: Stanislaw Kardach <skardach@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoocteontx2-af: fix LD CUSTOM LTYPE aliasing
Stanislaw Kardach [Tue, 29 Sep 2020 09:28:14 +0000 (11:28 +0200)]
octeontx2-af: fix LD CUSTOM LTYPE aliasing

Since LD contains LTYPE definitions tweaked toward efficient
NIX_AF_RX_FLOW_KEY_ALG(0..31)_FIELD(0..4) usage, the original location
of NPC_LT_LD_CUSTOM0/1 was aliased with MPLS_IN_* definitions.
Moving custom frame to value 6 and 7 removes the aliasing at the cost of
custom frames being also considered when TCP/UDP RSS algo is configured.

However since the goal of CUSTOM frames is to classify them to a
separate set of RQs, this cost is acceptable.

Signed-off-by: Stanislaw Kardach <skardach@marvell.com>
Acked-by: Sunil Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/sched: cls_u32: Replace one-element array with flexible-array member
Gustavo A. R. Silva [Mon, 28 Sep 2020 15:30:52 +0000 (10:30 -0500)]
net/sched: cls_u32: Replace one-element array with flexible-array member

There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].

Refactor the code according to the use of a flexible-array member in
struct tc_u_hnode and use the struct_size() helper to calculate the
size for the allocations. Commit 5778d39d070b ("net_sched: fix struct
tc_u_hnode layout in u32") makes it clear that the code is expected to
dynamically allocate divisor + 1 entries for ->ht[] in tc_uhnode. Also,
based on other observations, as the piece of code below:

1232                 for (h = 0; h <= ht->divisor; h++) {
1233                         for (n = rtnl_dereference(ht->ht[h]);
1234                              n;
1235                              n = rtnl_dereference(n->next)) {
1236                                 if (tc_skip_hw(n->flags))
1237                                         continue;
1238
1239                                 err = u32_reoffload_knode(tp, n, add, cb,
1240                                                           cb_priv, extack);
1241                                 if (err)
1242                                         return err;
1243                         }
1244                 }

we can assume that, in general, the code is actually expecting to allocate
that extra space for the one-element array in tc_uhnode, everytime it
allocates memory for instances of tc_uhnode or tc_u_common structures.
That's the reason for passing '1' as the last argument for struct_size()
in the allocation for _root_ht_ and _tp_c_, and 'divisor + 1' in the
allocation code for _ht_.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays

Tested-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/5f7062af.z3T9tn9yIPv6h5Ny%25lkp@intel.com/
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoqed/qed_ll2: Replace one-element array with flexible-array member
Gustavo A. R. Silva [Mon, 28 Sep 2020 15:16:17 +0000 (10:16 -0500)]
qed/qed_ll2: Replace one-element array with flexible-array member

There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members”[1] for these cases. The older
style of one-element or zero-length arrays should no longer be used[2].

Refactor the code according to the use of a flexible-array member in
struct qed_ll2_tx_packet, instead of a one-element array and use the
struct_size() helper to calculate the size for the allocations. Commit
f5823fe6897c ("qed: Add ll2 option to limit the number of bds per packet")
was used as a reference point for these changes.

Also, it's important to notice that flexible-array members should occur
last in any structure, and structures containing such arrays and that
are members of other structures, must also occur last in the containing
structure. That's why _cur_completing_packet_ is now moved to the bottom
in struct qed_ll2_tx_queue. _descq_mem_ and _cur_send_packet_ are also
moved for unification.

[1] https://en.wikipedia.org/wiki/Flexible_array_member
[2] https://www.kernel.org/doc/html/v5.9-rc1/process/deprecated.html#zero-length-and-one-element-arrays

Tested-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/5f707198.PA1UCZ8MYozYZYAR%25lkp@intel.com/
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agostmmac: intel: Adding ref clock 1us tic for LPI cntr
Rusaimi Amira Ruslan [Mon, 28 Sep 2020 10:12:12 +0000 (18:12 +0800)]
stmmac: intel: Adding ref clock 1us tic for LPI cntr

Adding reference clock (1us tic) for all LPI timer on Intel platforms.
The reference clock is derived from ptp clk. This also enables all LPI
counter.

Signed-off-by: Rusaimi Amira Ruslan <rusaimi.amira.rusaimi@intel.com>
Signed-off-by: Voon Weifeng <weifeng.voon@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-ipa-miscellaneous-cleanups'
David S. Miller [Tue, 29 Sep 2020 01:34:56 +0000 (18:34 -0700)]
Merge branch 'net-ipa-miscellaneous-cleanups'

Alex Elder says:

====================
net: ipa: miscellaneous cleanups

This series contains some minor cleanups I've been meaning to get
around to for a while.  The first few remove the definitions of some
currently-unused symbols.  Several fix some warnings that are reported
when the build is done with "W=2".  All are simple and have no effect
on the operation of the code.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: fix two comments
Alex Elder [Mon, 28 Sep 2020 23:04:46 +0000 (18:04 -0500)]
net: ipa: fix two comments

In ipa_uc_response_hdlr() a comment uses the wrong function name
when it describes where a clock reference is taken.  Fix this.

Also fix the comment in ipa_uc_response_hdlr() to correctly refer to
ipa_uc_setup(), which is where the clock reference described here is
taken.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: rename a phandle variable
Alex Elder [Mon, 28 Sep 2020 23:04:45 +0000 (18:04 -0500)]
net: ipa: rename a phandle variable

When "W=2" is supplied to the build command, we get a warning about
shadowing a global declaration (of a typedef) for a variable defined
in ipa_probe().  Rename the variable to get rid of the warning.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: fix two mild warnings
Alex Elder [Mon, 28 Sep 2020 23:04:44 +0000 (18:04 -0500)]
net: ipa: fix two mild warnings

Fix two spots where a variable "channel_id" is unnecessarily
redefined inside loops in "gsi.c".  This is warned about if
"W=2" is added to the build command.

Note that this problem is harmless, so there's no need to backport
it as a bugfix.

Remove a comment in gsi_init() about waking the system; the GSI
interrupt does not wake the system any more.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: share field mask values for GSI general interrupt
Alex Elder [Mon, 28 Sep 2020 23:04:43 +0000 (18:04 -0500)]
net: ipa: share field mask values for GSI general interrupt

The GSI general interrupt is managed by three registers: enable;
status; and clear.  The three registers have same set of field bits
at the same locations.  Use a common set of field masks for all
three registers to avoid duplication.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: share field mask values for GSI global interrupt
Alex Elder [Mon, 28 Sep 2020 23:04:42 +0000 (18:04 -0500)]
net: ipa: share field mask values for GSI global interrupt

The GSI global interrupt is managed by three registers: enable;
status; and clear.  The three registers have same set of field bits
at the same locations.  Use a common set of field masks for all
three registers to avoid duplication.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: share field mask values for GSI interrupt type
Alex Elder [Mon, 28 Sep 2020 23:04:41 +0000 (18:04 -0500)]
net: ipa: share field mask values for GSI interrupt type

The GSI interrupt type register and interrupt type mask register
have the same field bits at the same locations.  Use a common set of
field masks for both registers rather than essentially duplicating
them.  The only place the interrupt mask register uses any of these
is in gsi_irq_enable().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: remove unused status structure field masks
Alex Elder [Mon, 28 Sep 2020 23:04:40 +0000 (18:04 -0500)]
net: ipa: remove unused status structure field masks

Most of the field masks used for fields in a status structure are
unused.  Remove their definitions; we can add them back again when
we actually use them to handle arriving status messages.  These are
warned about if "W=2" is added to the build command.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: kill unused status exceptions
Alex Elder [Mon, 28 Sep 2020 23:04:39 +0000 (18:04 -0500)]
net: ipa: kill unused status exceptions

Only the deaggregation status exception type is ever actually used.
If any other status exception type is reported we basically ignore
it, and consume the packet.  Remove the unused definitions of status
exception type symbols; they can be added back when we actually
handle them.

Separately, two consecutive if statements test the same condition
near the top of ipa_endpoint_suspend_one().  Instead, use a single
test with a block that combines the previously-separate lines of
code.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: kill unused status opcodes
Alex Elder [Mon, 28 Sep 2020 23:04:38 +0000 (18:04 -0500)]
net: ipa: kill unused status opcodes

Three status opcodes are not currently supported.  Symbols
representing their numeric values are defined but never used.
Remove those unused definitions; they can be defined again
when they actually get used.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ipa: kill definition of TRE_FLAGS_IEOB_FMASK
Alex Elder [Mon, 28 Sep 2020 23:04:37 +0000 (18:04 -0500)]
net: ipa: kill definition of TRE_FLAGS_IEOB_FMASK

In "gsi_trans.c", the field mask TRE_FLAGS_IEOB_FMASK is defined but
never used.  Although there's no harm in defining this, remove it
for now and redefine it at some future date if it becomes needed.
This is warned about if "W=2" is added to the build command.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'ibmvnic-refactor-some-send-handle-functions'
David S. Miller [Mon, 28 Sep 2020 23:06:08 +0000 (16:06 -0700)]
Merge branch 'ibmvnic-refactor-some-send-handle-functions'

Lijun Pan says:

====================
ibmvnic: refactor some send/handle functions

This patch series rename and factor some send crq request functions.
The new naming aligns better with handle* functions such that it make
the code easier to read and search by new contributors.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoibmvnic: create send_control_ip_offload
Lijun Pan [Mon, 28 Sep 2020 01:13:30 +0000 (20:13 -0500)]
ibmvnic: create send_control_ip_offload

Factor send_control_ip_offload out of handle_query_ip_offload_rsp.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoibmvnic: create send_query_ip_offload
Lijun Pan [Mon, 28 Sep 2020 01:13:29 +0000 (20:13 -0500)]
ibmvnic: create send_query_ip_offload

Factor send_query_ip_offload out of handle_request_cap_rsp to
pair with handle_query_ip_offload_rsp.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoibmvnic: rename send_map_query to send_query_map
Lijun Pan [Mon, 28 Sep 2020 01:13:28 +0000 (20:13 -0500)]
ibmvnic: rename send_map_query to send_query_map

The new name send_query_map pairs with handle_query_map_rsp.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoibmvnic: rename ibmvnic_send_req_caps to send_request_cap
Lijun Pan [Mon, 28 Sep 2020 01:13:27 +0000 (20:13 -0500)]
ibmvnic: rename ibmvnic_send_req_caps to send_request_cap

The new name send_request_cap pairs with handle_request_cap_rsp.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoibmvnic: rename send_cap_queries to send_query_cap
Lijun Pan [Mon, 28 Sep 2020 01:13:26 +0000 (20:13 -0500)]
ibmvnic: rename send_cap_queries to send_query_cap

The new name send_query_cap pairs with handle_query_cap_rsp.

Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoibmvnic: set up 200GBPS speed
Lijun Pan [Mon, 28 Sep 2020 00:06:25 +0000 (19:06 -0500)]
ibmvnic: set up 200GBPS speed

Set up the speed according to crq->query_phys_parms.rsp.speed.
Fix IBMVNIC_10GBPS typo.

Fixes: f8d6ae0d27ec ("ibmvnic: Report actual backing device speed and duplex values")
Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoatm: atmtcp: Constify atmtcp_v_dev_ops
Rikard Falkeborn [Sun, 27 Sep 2020 21:10:42 +0000 (23:10 +0200)]
atm: atmtcp: Constify atmtcp_v_dev_ops

The only usage of atmtcp_v_dev_ops is to pass its address to
atm_dev_register() which takes a pointer to const, and comparing its
address to another address, which does not modify it. Make it const to
allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoip6gre: avoid tx_error when sending MLD/DAD on external tunnels
Davide Caratti [Sun, 27 Sep 2020 14:08:21 +0000 (16:08 +0200)]
ip6gre: avoid tx_error when sending MLD/DAD on external tunnels

similarly to what has been done with commit 9d149045b3c0 ("geneve: change
from tx_error to tx_dropped on missing metadata"), avoid reporting errors
to userspace in case the kernel doesn't find any tunnel information for a
skb that is going to be transmitted: an increase of tx_dropped is enough.

tested with the following script:

 # for t in ip6gre ip6gretap ip6erspan; do
 > ip link add dev gre6-test0 type $t external
 > ip address add dev gre6-test0 2001:db8::1/64
 > ip link set dev gre6-test0 up
 > sleep 30
 > ip -s -j link show dev gre6-test0 | jq \
 > '.[0].stats64.tx | {"errors": .errors, "dropped": .dropped}'
 > ip link del dev gre6-test0
 > done

Reported-by: Jianlin Shi <jishi@redhat.com>
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'net-smc-introduce-SMC-Dv2-support'
David S. Miller [Mon, 28 Sep 2020 22:19:03 +0000 (15:19 -0700)]
Merge branch 'net-smc-introduce-SMC-Dv2-support'

Karsten Graul says:

====================
net/smc: introduce SMC-Dv2 support

SMC-Dv2 support (see https://www.ibm.com/support/pages/node/6326337)
provides multi-subnet support for SMC-D, eliminating the current
same-subnet restriction. The new version detects if any of the virtual
ISM devices are on the same system and can therefore be used for an
SMC-Dv2 connection. Furthermore, SMC-Dv2 eliminates the need for
PNET IDs on s390.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: CLC decline - V2 enhancements
Ursula Braun [Sat, 26 Sep 2020 10:44:32 +0000 (12:44 +0200)]
net/smc: CLC decline - V2 enhancements

This patch covers the small SMCD version 2 changes for CLC decline.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: introduce CLC first contact extension
Ursula Braun [Sat, 26 Sep 2020 10:44:31 +0000 (12:44 +0200)]
net/smc: introduce CLC first contact extension

SMC Version 2 defines a first contact extension for CLC accept
and CLC confirm. This patch covers sending and receiving of the
CLC first contact extension.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: CLC accept / confirm V2
Ursula Braun [Sat, 26 Sep 2020 10:44:30 +0000 (12:44 +0200)]
net/smc: CLC accept / confirm V2

The new format of SMCD V2 CLC accept and confirm is introduced,
and building and checking of SMCD V2 CLC accepts / confirms is adapted
accordingly.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: determine accepted ISM devices
Ursula Braun [Sat, 26 Sep 2020 10:44:29 +0000 (12:44 +0200)]
net/smc: determine accepted ISM devices

SMCD Version 2 allows to propose up to 8 additional ISM devices
offered to the peer as candidates for SMCD communication.
This patch covers the server side, i.e. selection of an ISM device
matching one of the proposed ISM devices, that will be used for
CLC accept

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: build and send V2 CLC proposal
Ursula Braun [Sat, 26 Sep 2020 10:44:28 +0000 (12:44 +0200)]
net/smc: build and send V2 CLC proposal

The new format of an SMCD V2 CLC proposal is introduced, and
building and checking of SMCD V2 CLC proposals is adapted
accordingly.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: determine proposed ISM devices
Ursula Braun [Sat, 26 Sep 2020 10:44:27 +0000 (12:44 +0200)]
net/smc: determine proposed ISM devices

SMCD Version 2 allows to propose up to 8 additional ISM devices
offered to the peer as candidates for SMCD communication.
This patch covers determination of the ISM devices to be proposed.
ISM devices without PNETID are preferred, since ISM devices with
PNETID are a V1 leftover and will disappear over the time.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: introduce list of pnetids for Ethernet devices
Ursula Braun [Sat, 26 Sep 2020 10:44:26 +0000 (12:44 +0200)]
net/smc: introduce list of pnetids for Ethernet devices

SMCD version 2 allows usage of ISM devices with hardware PNETID
only, if an Ethernet net_device exists with the same hardware PNETID.
This requires to maintain a list of pnetids belonging to
Ethernet net_devices, which is covered by this patch.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: introduce CHID callback for ISM devices
Ursula Braun [Sat, 26 Sep 2020 10:44:25 +0000 (12:44 +0200)]
net/smc: introduce CHID callback for ISM devices

With SMCD version 2 the CHIDs of ISM devices are needed for the
CLC handshake.
This patch provides the new callback to retrieve the CHID of an
ISM device.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: introduce System Enterprise ID (SEID)
Ursula Braun [Sat, 26 Sep 2020 10:44:24 +0000 (12:44 +0200)]
net/smc: introduce System Enterprise ID (SEID)

SMCD version 2 defines a System Enterprise ID (short SEID).
This patch contains the SEID creation and adds the callback to
retrieve the created SEID.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: prepare for more proposed ISM devices
Ursula Braun [Sat, 26 Sep 2020 10:44:23 +0000 (12:44 +0200)]
net/smc: prepare for more proposed ISM devices

SMCD Version 2 allows proposing of up to 8 ISM devices in addition
to the native ISM device of SMCD Version 1.
This patch prepares the struct smc_init_info to deal with these
additional 8 ISM devices.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: split CLC confirm/accept data to be sent
Ursula Braun [Sat, 26 Sep 2020 10:44:22 +0000 (12:44 +0200)]
net/smc: split CLC confirm/accept data to be sent

When sending CLC confirm and CLC accept, separate the trailing
part of the message from the initial part (to be prepared for
future first contact extension).

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: separate find device functions
Ursula Braun [Sat, 26 Sep 2020 10:44:21 +0000 (12:44 +0200)]
net/smc: separate find device functions

This patch provides better separation of device determinations
in function smc_listen_work(). No functional change.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: CLC header fields renaming
Ursula Braun [Sat, 26 Sep 2020 10:44:20 +0000 (12:44 +0200)]
net/smc: CLC header fields renaming

SMCD version 2 defines 2 more bits in the CLC header to specify
version 2 types. This patch prepares better naming of the CLC
header fields. No functional change.

Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet/smc: remove constant and introduce helper to check for a pnet id
Karsten Graul [Sat, 26 Sep 2020 10:44:19 +0000 (12:44 +0200)]
net/smc: remove constant and introduce helper to check for a pnet id

Use the existing symbol _S instead of SMC_ASCII_BLANK, and introduce a
helper to check if a pnetid is set. No functional change.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: Use kobj_to_dev() API
Wang Qing [Sat, 26 Sep 2020 06:49:18 +0000 (14:49 +0800)]
net: Use kobj_to_dev() API

Use kobj_to_dev() instead of container_of().

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: mvneta: try to use in-irq pp cache in mvneta_txq_bufs_free
Lorenzo Bianconi [Fri, 25 Sep 2020 14:09:11 +0000 (16:09 +0200)]
net: mvneta: try to use in-irq pp cache in mvneta_txq_bufs_free

Try to recycle the xdp tx buffer into the in-irq page_pool cache if
mvneta_txq_bufs_free is executed in the NAPI context for XDP_TX use case

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch '1GbE' of https://github.com/anguy11/next-queue
David S. Miller [Mon, 28 Sep 2020 21:54:13 +0000 (14:54 -0700)]
Merge branch '1GbE' of https://github.com/anguy11/next-queue

Tony Nguyen says:

====================
1GbE Intel Wired LAN Driver Updates 2020-09-28

This series contains updates to igb, igc, and e1000e drivers.

Sven Auhagen adds XDP support for igb.

Gal Hammer allows for 82576 to display part number string correctly for
igb.

Sasha adds device IDs for i221 and i226 parts. Exposes LPI counters and
removes unused fields in structures for igc. He also adds Meteor Lake
support for e1000e.

For igc, Andre renames IGC_TSYNCTXCTL_VALID to IGC_TSYNCTXCTL_TXTT_0 to
match the datasheet and adds a warning if it's not set when expected.
Removes the PTP Tx timestamp check in igc_ptp_tx_work() as it's already
checked in the watchdog_task. Cleans up some code by removing invalid error
bits, renaming a bit to match datasheet naming, and removing a, now
unneeded, macro.

Vinicius makes changes for igc PTP: removes calling SYSTIMR to latch timer
value, stores PTP time before a reset, and rejects schedules with times in
the future.

v2: Remove 'inline' from igb_xdp_tx_queue_mapping() and igb_rx_offset()
for patch 1
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoe1000e: Add support for Meteor Lake
Sasha Neftin [Thu, 13 Aug 2020 08:34:06 +0000 (11:34 +0300)]
e1000e: Add support for Meteor Lake

Add devices IDs for the next LOM generations that will be
available on the next Intel Client platform (Meteor Lake)
This patch provides the initial support for these devices

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Clean up nvm_info structure
Sasha Neftin [Thu, 10 Sep 2020 08:16:05 +0000 (11:16 +0300)]
igc: Clean up nvm_info structure

flash_bank_size and flash_base_addr field not in use and can
be removed from a nvm_info structure

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Reject schedules with a base_time in the future
Vinicius Costa Gomes [Wed, 2 Sep 2020 23:36:57 +0000 (16:36 -0700)]
igc: Reject schedules with a base_time in the future

When we set the BASET registers of i225 with a base_time in the
future, i225 will "hold" all packets until that base_time is reached,
causing a lot of TX Hangs.

As this behaviour seems contrary to the expectations of the IEEE
802.1Q standard (section 8.6.9, especially 8.6.9.4.5), let's start by
rejecting these types of schedules. If this is too limiting, we can
for example, setup a timer to configure the BASET registers closer to
the start time, only blocking the packets for a "short" while.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Export a way to read the PTP timer
Vinicius Costa Gomes [Wed, 2 Sep 2020 23:36:56 +0000 (16:36 -0700)]
igc: Export a way to read the PTP timer

The next patch will need a way to retrieve the current timestamp from
the NIC's PTP clock.

The 'i225' suffix is removed, if anything model specific is needed,
those specifics should be hidden by this function.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Remove reset disable flag
Sasha Neftin [Mon, 31 Aug 2020 11:53:29 +0000 (14:53 +0300)]
igc: Remove reset disable flag

Boolean reset disable flag not applicable for i225 device and
could be removed.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Save PTP time before a reset
Vinicius Costa Gomes [Thu, 20 Aug 2020 23:02:17 +0000 (16:02 -0700)]
igc: Save PTP time before a reset

Many TSN features depend on the internal PTP clock, so the internal
PTP jumping when the adapter is reset can cause problems, usually in
the form of "TX Hangs" warnings in the driver.

The solution is to save the PTP time before a reset and restore it
after the reset is done. The value of the PTP time is saved before a
reset and we use the difference from CLOCK_MONOTONIC from reset time
to now, to correct what's going to be the new PTP time.

This is heavily inspired by commit bf4bf09bdd91 ("i40e: save PTP time
before a device reset").

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Remove references to SYSTIMR register
Vinicius Costa Gomes [Thu, 20 Aug 2020 23:02:16 +0000 (16:02 -0700)]
igc: Remove references to SYSTIMR register

In i225, it's no longer necessary to use the SYSTIMR register to
latch the timer value, the timestamp is latched when SYSTIML is read.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Expose LPI counters
Sasha Neftin [Thu, 13 Aug 2020 15:18:15 +0000 (18:18 +0300)]
igc: Expose LPI counters

Completion to commit 900d1e8b346b ("igc: Add LPI counters")
LPI counters exposed by statistics update method.
A EEE TX LPI counter reflect the transmitter entries EEE (IEEE 802.3az)
into the LPI state. A EEE RX LPI counter reflect the receiver link
partner entries into EEE(IEEE 802.3az) LPI state.

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Clean RX descriptor error flags
Andre Guedes [Mon, 10 Aug 2020 21:08:30 +0000 (14:08 -0700)]
igc: Clean RX descriptor error flags

i225 advanced receive descriptor doesn't have the following extend error
bits: CE, SE, SEQ, CXE. In addition to that, the bit TCPE is called L4E
in the datasheet.

Clean up the code accordingly, and get rid of the macro
IGC_RXDEXT_ERR_FRAME_ERR_MASK since it doesn't make much sense anymore.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Remove timeout check from ptp_tx work
Andre Guedes [Tue, 28 Jul 2020 23:37:53 +0000 (16:37 -0700)]
igc: Remove timeout check from ptp_tx work

The Tx timestamp timeout is already checked by the watchdog_task
which runs periodically. In addition to that, from the ptp_tx work
perspective, if __IGC_PTP_TX_IN_PROGRESS flag is set we always want
handle the timestamp stored in hardware and update the skb. So remove
the timeout check in igc_ptp_tx_work() function.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Don't reschedule ptp_tx work
Andre Guedes [Tue, 28 Jul 2020 23:37:52 +0000 (16:37 -0700)]
igc: Don't reschedule ptp_tx work

The ptp_tx work is scheduled only if TSICR.TXTS bit is set, therefore
TSYNCTXCTL.TXTT_0 bit is expected to be set when we check it igc_ptp_tx_
work(). If it isn't, something is really off and rescheduling the ptp_tx
work to check it later doesn't help much. This patch changes the code to
WARN_ON_ONCE() if this situation ever happens.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Rename IGC_TSYNCTXCTL_VALID macro
Andre Guedes [Tue, 28 Jul 2020 23:37:51 +0000 (16:37 -0700)]
igc: Rename IGC_TSYNCTXCTL_VALID macro

Rename the IGC_TSYNCTXCTL_VALID macro to IGC_TSYNCTXCTL_TXTT_0 so it
matches the datasheet.

Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigc: Add new device ID's
Sasha Neftin [Mon, 3 Aug 2020 18:33:58 +0000 (21:33 +0300)]
igc: Add new device ID's

Add new device ID's for the next step of the silicon and
reflect i221 and i226 parts

Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigb: read PBA number from flash
Gal Hammer [Sun, 30 Aug 2020 05:45:29 +0000 (08:45 +0300)]
igb: read PBA number from flash

Fixed flash presence check for 82576 controllers so the part
number string is read and displayed correctly.

Signed-off-by: Gal Hammer <ghammer@redhat.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoigb: add XDP support
Sven Auhagen [Wed, 2 Sep 2020 20:32:22 +0000 (13:32 -0700)]
igb: add XDP support

Add XDP support to the IGB driver.
The implementation follows the IXGBE XDP implementation
closely and I used the following patches as basis:

1. commit 924708081629 ("ixgbe: add XDP support for pass and drop actions")
2. commit 33fdc82f0883 ("ixgbe: add support for XDP_TX action")
3. commit ed93a3987128 ("ixgbe: tweak page counting for XDP_REDIRECT")

Due to the hardware constraints of the devices using the
IGB driver we must share the TX queues with XDP which
means locking the TX queue for XDP.

I ran tests on an older device to get better numbers.
Test machine:

Intel(R) Atom(TM) CPU C2338 @ 1.74GHz (2 Cores)
2x Intel I211

Routing Original Driver Network Stack: 382 Kpps

Routing XDP Redirect (xdp_fwd_kern): 1.48 Mpps
XDP Drop: 1.48 Mpps

Using XDP we can achieve line rate forwarding even on
an older Intel Atom CPU.

Signed-off-by: Sven Auhagen <sven.auhagen@voleatech.de>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
4 years agoMerge branch 'udp_tunnel-convert-Intel-drivers-with-shared-tables'
David S. Miller [Mon, 28 Sep 2020 19:50:13 +0000 (12:50 -0700)]
Merge branch 'udp_tunnel-convert-Intel-drivers-with-shared-tables'

Jakub Kicinski says:

====================
udp_tunnel: convert Intel drivers with shared tables

This set converts Intel drivers which have the ability to spawn
multiple netdevs, but have only one UDP tunnel port table.

Appropriate support is added to the core infra in patch 1,
followed by netdevsim support and a selftest.

The table sharing works by core attaching the same table
structure to all devices sharing the table. This means the
reference count has to accommodate potentially large values.

Once core is ready i40e and ice are converted. These are
complex drivers, but we got a tested-by from Aaron, so we
should be good :)

Compared to v1 I've made sure the selftest is executable.

Other than that patches 8 and 9 are actually from the Mellanox
conversion series were kept out to avoid Mellanox vs Intel
conflicts.

Last patch is new, some docs to let users knows ethtool
can now display UDP tunnel info.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agodocs: vxlan: add info about device features
Jakub Kicinski [Sat, 26 Sep 2020 00:56:49 +0000 (17:56 -0700)]
docs: vxlan: add info about device features

Add some information about VxLAN-related netdev features
and how to dump port table via ethtool.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: net: add a test for static UDP tunnel ports
Jakub Kicinski [Sat, 26 Sep 2020 00:56:48 +0000 (17:56 -0700)]
selftests: net: add a test for static UDP tunnel ports

Check UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN works as expected.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetdevsim: support the static IANA VXLAN port flag
Jakub Kicinski [Sat, 26 Sep 2020 00:56:47 +0000 (17:56 -0700)]
netdevsim: support the static IANA VXLAN port flag

Allow setting UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: convert to new udp_tunnel infrastructure
Jakub Kicinski [Sat, 26 Sep 2020 00:56:46 +0000 (17:56 -0700)]
ice: convert to new udp_tunnel infrastructure

Convert ice to the new infra, use share port tables.

Leave a tiny bit more error checking in place than usual,
because this driver really does quite a bit of magic.

We need to calculate the number of VxLAN and GENEVE entries
the firmware has reserved.

Thanks to the conversion the driver will no longer sleep in
an atomic section.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoice: remove unused args from ice_get_open_tunnel_port()
Jakub Kicinski [Sat, 26 Sep 2020 00:56:45 +0000 (17:56 -0700)]
ice: remove unused args from ice_get_open_tunnel_port()

ice_get_open_tunnel_port() is always passed TNL_ALL
as the second parameter.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoi40e: convert to new udp_tunnel infrastructure
Jakub Kicinski [Sat, 26 Sep 2020 00:56:44 +0000 (17:56 -0700)]
i40e: convert to new udp_tunnel infrastructure

Make use of the "shared port table" to convert i40e to the new
infra.

i40e did not have any reference tracking, locking is also dodgy
because rtnl gets released while talking to FW, so port may get
removed from the table while it's getting added etc.

On the good side i40e does not seem to be using the ports for
TX so we can remove the table from the driver state completely.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoselftests: net: add a test for shared UDP tunnel info tables
Jakub Kicinski [Sat, 26 Sep 2020 00:56:43 +0000 (17:56 -0700)]
selftests: net: add a test for shared UDP tunnel info tables

Add a test run of checks validating the shared UDP tunnel port
tables function as we expect.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetdevsim: shared UDP tunnel port table support
Jakub Kicinski [Sat, 26 Sep 2020 00:56:42 +0000 (17:56 -0700)]
netdevsim: shared UDP tunnel port table support

Add the ability to simulate a device with a shared UDP tunnel port
table.

Try to reject the configurations and actions which are not supported
by the core, so we don't get syzcaller etc. warning reports.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonetdevsim: add warnings on unexpected UDP tunnel port errors
Jakub Kicinski [Sat, 26 Sep 2020 00:56:41 +0000 (17:56 -0700)]
netdevsim: add warnings on unexpected UDP tunnel port errors

We should never see a removal of a port which is not in the table
or adding a port to an occupied entry in the table. To make sure
such errors don't escape the checks in the test script add a
warning/kernel spat.

Error injection will not trigger those, nor should it ever put
us in a bad state.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoudp_tunnel: add the ability to share port tables
Jakub Kicinski [Sat, 26 Sep 2020 00:56:40 +0000 (17:56 -0700)]
udp_tunnel: add the ability to share port tables

Unfortunately recent Intel NIC designs share the UDP port table
across netdevs. So far the UDP tunnel port state was maintained
per netdev, we need to extend that to cater to Intel NICs.

Expect NICs to allocate the info structure dynamically and link
to the state from there. All the shared NICs will record port
offload information in the one instance of the table so we need
to make sure that the use count can accommodate larger numbers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'DP83869-WoL-and-Speed-optimization'
David S. Miller [Mon, 28 Sep 2020 19:44:13 +0000 (12:44 -0700)]
Merge branch 'DP83869-WoL-and-Speed-optimization'

Dan Murphy says:

====================
DP83869 WoL and Speed optimization

Add the WoL and Speed Optimization (aka downshift) support for the DP83869
Ethernet PHY.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: dp83869: Add speed optimization feature
Dan Murphy [Mon, 28 Sep 2020 14:51:35 +0000 (09:51 -0500)]
net: phy: dp83869: Add speed optimization feature

Set the speed optimization bit on the DP83869 PHY.

Speed optimization, also known as link downshift, enables fallback to 100M
operation after multiple consecutive failed attempts at Gigabit link
establishment. Such a case could occur if cabling with only four wires
(two twisted pairs) were connected instead of the standard cabling with
eight wires (four twisted pairs).

The number of failed link attempts before falling back to 100M operation is
configurable. By default, four failed link attempts are required before
falling back to 100M.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: phy: dp83869: support Wake on LAN
Dan Murphy [Mon, 28 Sep 2020 14:51:34 +0000 (09:51 -0500)]
net: phy: dp83869: support Wake on LAN

This adds WoL support on TI DP83869 for magic, magic secure, unicast and
broadcast.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: ethernet: ave: Replace alloc_etherdev() with devm_alloc_etherdev()
Kunihiko Hayashi [Mon, 28 Sep 2020 10:04:53 +0000 (19:04 +0900)]
net: ethernet: ave: Replace alloc_etherdev() with devm_alloc_etherdev()

Use devm_alloc_etherdev() to simplify the code instead of alloc_etherdev().

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: vlan: Fixed signedness in vlan_group_prealloc_vid()
Florian Fainelli [Mon, 28 Sep 2020 02:31:50 +0000 (19:31 -0700)]
net: vlan: Fixed signedness in vlan_group_prealloc_vid()

After commit d0186842ec5f ("net: vlan: Avoid using BUG() in
vlan_proto_idx()"), vlan_proto_idx() was changed to return a signed
integer, however one of its called: vlan_group_prealloc_vid() was still
using an unsigned integer for its return value, fix that.

Fixes: d0186842ec5f ("net: vlan: Avoid using BUG() in vlan_proto_idx()")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'bnxt_en-Update-for-net-next'
David S. Miller [Sun, 27 Sep 2020 20:35:46 +0000 (13:35 -0700)]
Merge branch 'bnxt_en-Update-for-net-next'

Michael Chan says:

====================
bnxt_en: Update for net-next.

This patch series adds 2 main features to the bnxt_en driver: 200G
link speed support and FEC support with some refactoring of the
link speed logic.  The firmware interface is updated to have proper
support for these 2 features.  The ethtool preset max channel value
is also adjusted properly to account for XDP and TCs.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Improve preset max value for ethtool -l.
Michael Chan [Sun, 27 Sep 2020 17:42:20 +0000 (13:42 -0400)]
bnxt_en: Improve preset max value for ethtool -l.

The current logic that calculates the preset maximum value for combined
channel does not take into account the rings used for XDP and mqprio
TCs.  Each of these features will reduce the number of TX rings.  Add
the logic to divide the TX rings accordingly based on whether the
device is currently in XDP mode and whether TCs are in use.

Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Implement ethtool set_fec_param() method.
Michael Chan [Sun, 27 Sep 2020 17:42:19 +0000 (13:42 -0400)]
bnxt_en: Implement ethtool set_fec_param() method.

This feature allows the user to set the different FEC modes on the NIC
port.  Any new setting will take effect immediately after a link toggle.

Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Report Active FEC encoding during link up.
Michael Chan [Sun, 27 Sep 2020 17:42:18 +0000 (13:42 -0400)]
bnxt_en: Report Active FEC encoding during link up.

The current code is reporting the FEC configured settings during link up.
Change it to report the more useful active FEC encoding that may be
negotiated or auto detected.

Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Report FEC settings to ethtool.
Michael Chan [Sun, 27 Sep 2020 17:42:17 +0000 (13:42 -0400)]
bnxt_en: Report FEC settings to ethtool.

Implement .get_fecparam() method to report the configured and active FEC
settings.  Also report the supported and advertised FEC settings to
the .get_link_ksettings() method.

Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: avoid link reset if speed is not changed
Edwin Peer [Sun, 27 Sep 2020 17:42:16 +0000 (13:42 -0400)]
bnxt_en: avoid link reset if speed is not changed

PORT_PHY_CONFIG is always sent with REQ_FLAGS_RESET_PHY set. This flag
must be set in order for the firmware to institute the requested PHY
change immediately, but it results in a link flap. This is unnecessary
and results in an improved user experience if the PHY reconfiguration
is avoided when the user requested speed does not constitute a change.

Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Handle ethernet link being disabled by firmware.
Michael Chan [Sun, 27 Sep 2020 17:42:15 +0000 (13:42 -0400)]
bnxt_en: Handle ethernet link being disabled by firmware.

On some 200G dual port NICs, if one port is configured to 200G,
firmware will disable the ethernet link on the other port.  Firmware
will send notification to the driver for the disabled port when this
happens.  Define a new field in the link_info structure to keep track
of this state.  The new phy_state field replaces the unused loop_back
field.

Log a message when the phy_state changes state.  In the disabled state,
disallow any PHY configurations on the disabled port as the firmware
will fail all calls to configure the PHY in this state.

Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: ethtool: support PAM4 link speeds up to 200G
Edwin Peer [Sun, 27 Sep 2020 17:42:14 +0000 (13:42 -0400)]
bnxt_en: ethtool: support PAM4 link speeds up to 200G

Add ethtool PAM4 link modes for:
        50000baseCR_Full
        100000baseCR2_Full
        200000baseCR4_Full

Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: add basic infrastructure to support PAM4 link speeds
Edwin Peer [Sun, 27 Sep 2020 17:42:13 +0000 (13:42 -0400)]
bnxt_en: add basic infrastructure to support PAM4 link speeds

The firmware interface has added support for new link speeds using
PAM4 modulation.  Expand the bnxt_link_info structure to closely
mirror the new firmware structures.  Add logic to copy the PAM4
capabilities and settings from the firmware.

Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: refactor bnxt_get_fw_speed()
Edwin Peer [Sun, 27 Sep 2020 17:42:12 +0000 (13:42 -0400)]
bnxt_en: refactor bnxt_get_fw_speed()

It will be necessary to update more than one field in the link_info
structure when PAM4 speeds are added in a later patch. Instead of
merely translating ethtool speed values to firmware speed values,
change the responsiblity of this function to update all the necessary
link_info fields required to force the speed change to the desired
ethtool value. This also reduces code duplication somewhat at the two
call sites, which otherwise both have to independently update link_info
fields to turn off auto negotiation advertisements.

Also use the appropriate REQ_FORCE_LINK_SPEED definitions. These happen
to have the same values, but req_link_speed is utilimately passed as
force_link_speed in HWRM_PORT_PHY_CFG which is not defined in terms of
REQ_AUTO_LINK_SPEED.

Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: refactor code to limit speed advertising
Edwin Peer [Sun, 27 Sep 2020 17:42:11 +0000 (13:42 -0400)]
bnxt_en: refactor code to limit speed advertising

Extract the code for determining an advertised speed is no longer
supported into a separate function. This will avoid some code
duplication in a later patch when supporting PAM4 speeds, since
these speeds are specified in a separate field.

Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agobnxt_en: Update firmware interface spec to 1.10.1.65.
Michael Chan [Sun, 27 Sep 2020 17:42:10 +0000 (13:42 -0400)]
bnxt_en: Update firmware interface spec to 1.10.1.65.

The main changes include FEC, ECN statistics, HWRM_PORT_PHY_QCFG
response size reduction, and a new counter added to
ctx_hw_stats_ext struct to support the new 58818 chip.

The ctx_hw_stats_ext structure is now the superset supporting the new
58818 chips and the prior P5 chips.  Add a new flag to identify the new
chip and use constants for the chip specific ring statistics sizes
instead of the size of the structure.

Because the HWRM_PORT_PHY_QCFG response structure size has shrunk back
to 96 bytes, the workaround added earlier to limit the size of this
message for forwarding to the VF can be removed.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoptp: add stub function for ptp_get_msgtype()
Yangbo Lu [Sun, 27 Sep 2020 08:01:50 +0000 (16:01 +0800)]
ptp: add stub function for ptp_get_msgtype()

Added the missing stub function for ptp_get_msgtype().

Fixes: 036c508ba95e ("ptp: Add generic ptp message type function")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agonet: marvell: mvpp2: Fix W=1 warning with !CONFIG_ACPI
Andrew Lunn [Sat, 26 Sep 2020 21:26:03 +0000 (23:26 +0200)]
net: marvell: mvpp2: Fix W=1 warning with !CONFIG_ACPI

rivers/net/ethernet/marvell/mvpp2/mvpp2_main.c:7084:36: warning: ‘mvpp2_acpi_match’ defined but not used [-Wunused-const-variable=]
 7084 | static const struct acpi_device_id mvpp2_acpi_match[] = {
      |                                    ^~~~~~~~~~~~~~~~

Wrap the definition inside #ifdef/#endif.

Compile tested only.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
4 years agoMerge branch 'mlxsw-Expose-transceiver-overheat-counter'
David S. Miller [Sun, 27 Sep 2020 20:27:01 +0000 (13:27 -0700)]
Merge branch 'mlxsw-Expose-transceiver-overheat-counter'

Ido Schimmel says:

====================
mlxsw: Expose transceiver overheat counter

Amit says:

An overheated transceiver can be the root cause of various network
problems such as link flapping. Counting the number of times a
transceiver's temperature was higher than its configured threshold can
therefore help in debugging such issues.

This patch set exposes a transceiver overheat counter via ethtool. This
is achieved by configuring the Spectrum ASIC to generate events whenever
a transceiver is overheated. The temperature thresholds are queried from
the transceiver (if available) and set to the default otherwise.

Example:

...
transceiver_overheat: 2

Patch set overview:

Patches #1-#3 add required device registers
Patches #4-#5 add required infrastructure in mlxsw to configure and
count overheat events
Patches #6-#9 gradually add support for the transceiver overheat counter
Patch #10 exposes the transceiver overheat counter via ethtool
====================

Signed-off-by: David S. Miller <davem@davemloft.net>