]> asedeno.scripts.mit.edu Git - linux.git/log
linux.git
5 years agonet: sched: prevent insertion of new classifiers during chain flush
Vlad Buslov [Mon, 11 Feb 2019 08:55:42 +0000 (10:55 +0200)]
net: sched: prevent insertion of new classifiers during chain flush

Extend tcf_chain with 'flushing' flag. Use the flag to prevent insertion of
new classifier instances when chain flushing is in progress in order to
prevent resource leak when tcf_proto is created by unlocked users
concurrently.

Return EAGAIN error from tcf_chain_tp_insert_unique() to restart
tc_new_tfilter() and lookup the chain/proto again.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: refactor tp insert/delete for concurrent execution
Vlad Buslov [Mon, 11 Feb 2019 08:55:41 +0000 (10:55 +0200)]
net: sched: refactor tp insert/delete for concurrent execution

Implement unique insertion function to atomically attach tcf_proto to chain
after verifying that no other tcf proto with specified priority exists.
Implement delete function that verifies that tp is actually empty before
deleting it. Use these functions to refactor cls API to account for
concurrent tp and rule update instead of relying on rtnl lock. Add new
'deleting' flag to tcf proto. Use it to restart search when iterating over
tp's on chain to prevent accessing potentially inval tp->next pointer.

Extend tcf proto with spinlock that is intended to be used to protect its
data from concurrent modification instead of relying on rtnl mutex. Use it
to protect 'deleting' flag. Add lockdep macros to validate that lock is
held when accessing protected fields.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: traverse classifiers in chain with tcf_get_next_proto()
Vlad Buslov [Mon, 11 Feb 2019 08:55:40 +0000 (10:55 +0200)]
net: sched: traverse classifiers in chain with tcf_get_next_proto()

All users of chain->filters_chain rely on rtnl lock and assume that no new
classifier instances are added when traversing the list. Use
tcf_get_next_proto() to traverse filters list without relying on rtnl
mutex. This function iterates over classifiers by taking reference to
current iterator classifier only and doesn't assume external
synchronization of filters list.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: introduce reference counting for tcf_proto
Vlad Buslov [Mon, 11 Feb 2019 08:55:39 +0000 (10:55 +0200)]
net: sched: introduce reference counting for tcf_proto

In order to remove dependency on rtnl lock and allow concurrent tcf_proto
modification, extend tcf_proto with reference counter. Implement helper
get/put functions for tcf proto and use them to modify cls API to always
take reference to tcf_proto while using it. Only release reference to
parent chain after releasing last reference to tp.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: protect filter_chain list with filter_chain_lock mutex
Vlad Buslov [Mon, 11 Feb 2019 08:55:38 +0000 (10:55 +0200)]
net: sched: protect filter_chain list with filter_chain_lock mutex

Extend tcf_chain with new filter_chain_lock mutex. Always lock the chain
when accessing filter_chain list, instead of relying on rtnl lock.
Dereference filter_chain with tcf_chain_dereference() lockdep macro to
verify that all users of chain_list have the lock taken.

Rearrange tp insert/remove code in tc_new_tfilter/tc_del_tfilter to execute
all necessary code while holding chain lock in order to prevent
invalidation of chain_info structure by potential concurrent change. This
also serializes calls to tcf_chain0_head_change(), which allows head change
callbacks to rely on filter_chain_lock for synchronization instead of rtnl
mutex.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: protect chain template accesses with block lock
Vlad Buslov [Mon, 11 Feb 2019 08:55:37 +0000 (10:55 +0200)]
net: sched: protect chain template accesses with block lock

When cls API is called without protection of rtnl lock, parallel
modification of chain is possible, which means that chain template can be
changed concurrently in certain circumstances. For example, when chain is
'deleted' by new user-space chain API, the chain might continue to be used
if it is referenced by actions, and can be 're-created' again by user. In
such case same chain structure is reused and its template is changed. To
protect from described scenario, cache chain template while holding block
lock. Introduce standalone tc_chain_notify_delete() function that works
with cached template values, instead of chains themselves.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: traverse chains in block with tcf_get_next_chain()
Vlad Buslov [Mon, 11 Feb 2019 08:55:36 +0000 (10:55 +0200)]
net: sched: traverse chains in block with tcf_get_next_chain()

All users of block->chain_list rely on rtnl lock and assume that no new
chains are added when traversing the list. Use tcf_get_next_chain() to
traverse chain list without relying on rtnl mutex. This function iterates
over chains by taking reference to current iterator chain only and doesn't
assume external synchronization of chain list.

Don't take reference to all chains in block when flushing and use
tcf_get_next_chain() to safely iterate over chain list instead. Remove
tcf_block_put_all_chains() that is no longer used.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: protect block->chain0 with block->lock
Vlad Buslov [Mon, 11 Feb 2019 08:55:35 +0000 (10:55 +0200)]
net: sched: protect block->chain0 with block->lock

In order to remove dependency on rtnl lock, use block->lock to protect
chain0 struct from concurrent modification. Rearrange code in chain0
callback add and del functions to only access chain0 when block->lock is
held.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: refactor tc_ctl_chain() to use block->lock
Vlad Buslov [Mon, 11 Feb 2019 08:55:34 +0000 (10:55 +0200)]
net: sched: refactor tc_ctl_chain() to use block->lock

In order to remove dependency on rtnl lock, modify chain API to use
block->lock to protect chain from concurrent modification. Rearrange
tc_ctl_chain() code to call tcf_chain_hold() while holding block->lock to
prevent concurrent chain removal.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: protect chain->explicitly_created with block->lock
Vlad Buslov [Mon, 11 Feb 2019 08:55:33 +0000 (10:55 +0200)]
net: sched: protect chain->explicitly_created with block->lock

In order to remove dependency on rtnl lock, protect
tcf_chain->explicitly_created flag with block->lock. Consolidate code that
checks and resets 'explicitly_created' flag into __tcf_chain_put() to
execute it atomically with rest of code that puts chain reference.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: sched: protect block state with mutex
Vlad Buslov [Mon, 11 Feb 2019 08:55:32 +0000 (10:55 +0200)]
net: sched: protect block state with mutex

Currently, tcf_block doesn't use any synchronization mechanisms to protect
critical sections that manage lifetime of its chains. block->chain_list and
multiple variables in tcf_chain that control its lifetime assume external
synchronization provided by global rtnl lock. Converting chain reference
counting to atomic reference counters is not possible because cls API uses
multiple counters and flags to control chain lifetime, so all of them must
be synchronized in chain get/put code.

Use single per-block lock to protect block data and manage lifetime of all
chains on the block. Always take block->lock when accessing chain_list.
Chain get and put modify chain lifetime-management data and parent block's
chain_list, so take the lock in these functions. Verify block->lock state
with assertions in functions that expect to be called with the lock taken
and are called from multiple places. Take block->lock when accessing
filter_chain_list.

In order to allow parallel update of rules on single block, move all calls
to classifiers outside of critical sections protected by new block->lock.
Rearrange chain get and put functions code to only access protected chain
data while holding block lock:
- Rearrange code to only access chain reference counter and chain action
  reference counter while holding block lock.
- Extract code that requires block->lock from tcf_chain_destroy() into
  standalone tcf_chain_destroy() function that is called by
  __tcf_chain_put() in same critical section that changes chain reference
  counters.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoisdn_v110: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 11 Feb 2019 22:42:37 +0000 (16:42 -0600)]
isdn_v110: mark expected switch fall-through

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

This patch fixes the following warnings:

drivers/isdn/i4l/isdn_v110.c: In function ‘EncodeMatrix’:
drivers/isdn/i4l/isdn_v110.c:353:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (line >= mlen) {
       ^
drivers/isdn/i4l/isdn_v110.c:358:3: note: here
   case 128:
   ^~~~

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

Notice that, in this particular case, the code comment is modified
in accordance with what GCC is expecting to find.

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoisdn: i4l: isdn_tty: Mark expected switch fall-through
Gustavo A. R. Silva [Mon, 11 Feb 2019 22:38:21 +0000 (16:38 -0600)]
isdn: i4l: isdn_tty: Mark expected switch fall-through

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

This patch fixes the following warnings:

drivers/isdn/i4l/isdn_tty.c: In function ‘isdn_tty_edit_at’:
drivers/isdn/i4l/isdn_tty.c:3644:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
       m->mdmcmdl = 0;
       ~~~~~~~~~~~^~~
drivers/isdn/i4l/isdn_tty.c:3646:5: note: here
     case 0:
     ^~~~

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

Notice that, in this particular case, the code comment is modified
in accordance with what GCC is expecting to find.

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoser_gigaset: mark expected switch fall-through
Gustavo A. R. Silva [Mon, 11 Feb 2019 22:34:44 +0000 (16:34 -0600)]
ser_gigaset: mark expected switch fall-through

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

This patch fixes the following warning:

drivers/isdn/gigaset/ser-gigaset.c: In function ‘gigaset_tty_ioctl’:
drivers/isdn/gigaset/ser-gigaset.c:627:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
   switch (arg) {
   ^~~~~~
drivers/isdn/gigaset/ser-gigaset.c:638:2: note: here
  default:
  ^~~~~~~

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

Notice that, in this particular case, the code comment is modified
in accordance with what GCC is expecting to find.

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

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 's390-qeth-next'
David S. Miller [Tue, 12 Feb 2019 18:14:24 +0000 (13:14 -0500)]
Merge branch 's390-qeth-next'

Julian Wiedmann says:

====================
s390/qeth: updates 2019-02-12

please apply one more round of qeth patches to net-next.
This series targets the driver's control paths. It primarily brings improvements
to the error handling for sent cmds and received responses, along with the
usual cleanup and consolidation efforts.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: convert remaining legacy cmd callbacks
Julian Wiedmann [Tue, 12 Feb 2019 17:33:25 +0000 (18:33 +0100)]
s390/qeth: convert remaining legacy cmd callbacks

This calls the existing errno translation helpers from the callbacks,
adding trivial wrappers where necessary. For cmds that have no
sophisticated errno translation, default to -EIO.

For IPA cmds with no callback, fall back to a minimal default. This is
currently being used by qeth_l3_send_setrouting().

Thus having all converted all callbacks, remove the legacy path in
qeth_send_control_data_cb().

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: convert bridgeport callbacks
Julian Wiedmann [Tue, 12 Feb 2019 17:33:24 +0000 (18:33 +0100)]
s390/qeth: convert bridgeport callbacks

By letting the callbacks deal with error translation, we no longer need
to pass the raw error codes back to the originator. This allows us to
slim down the callback's private data, and nicely simplifies the code.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: allow cmd callbacks to return errnos
Julian Wiedmann [Tue, 12 Feb 2019 17:33:23 +0000 (18:33 +0100)]
s390/qeth: allow cmd callbacks to return errnos

Error propagation from cmd callbacks currently works in a way where
qeth_send_control_data_cb() picks the raw HW code from the response,
and the cmd's originator later translates this into an errno.
The callback itself only returns 0 ("done") or 1 ("expect more data").

This is
1. limiting, as the only means for the callback to report an internal
error is to invent pseudo HW codes (such as IPA_RC_ENOMEM), that
the originator then needs to understand. For non-IPA callbacks, we
even provide a separate field in the IO buffer metadata (iob->rc) so
the callback can pass back a return value.
2. fragile, as the originator must take care to not translate any errno
that is returned by qeth's own IO code paths (eg -ENOMEM). Also, any
originator that forgets to translate the HW codes potentially passes
garbage back to its caller. For instance, see
commit 2aa4867198c2 ("s390/qeth: translate SETVLAN/DELVLAN errors").

Introduce a new model where all HW error translation is done within the
callback, and the callback returns
>  0, if it expects more data (as before)
== 0, on success
<  0, with an errno

Start off with converting all callbacks to the new model that either
a) pass back pseudo HW codes, or b) have a dependency on a specific
HW error code. Also convert c) the one callback that uses iob->rc, and
d) qeth_setadpparms_change_macaddr_cb() so that it can pass back an
error back to qeth_l2_request_initial_mac() even when the cmd itself
was successful.

The old model remains supported: if the callback returns 0, we still
propagate the response's HW error code back to the originator.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: cancel cmd on early error
Julian Wiedmann [Tue, 12 Feb 2019 17:33:22 +0000 (18:33 +0100)]
s390/qeth: cancel cmd on early error

When sending cmds via qeth_send_control_data(), qeth puts the request
on the IO channel and then blocks on the reply object until the response
has been received.

If the IO completes with error, there will never be a response and we
block until the reply-wait hits its timeout. For this case, connect the
request buffer to its reply object, so that we can immediately cancel
the wait.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: simplify reply object handling
Julian Wiedmann [Tue, 12 Feb 2019 17:33:21 +0000 (18:33 +0100)]
s390/qeth: simplify reply object handling

Current code enqueues & dequeues a reply object from the waiter list
in various places. In particular, the dequeue & enqueue in
qeth_send_control_data_cb() looks fragile - this can cause
qeth_clear_ipacmd_list() to skip the active object.
Add some helpers, and boil the logic down by giving
qeth_send_control_data() the sole responsibility to add and remove
objects.

qeth_send_control_data_cb() and qeth_clear_ipacmd_list() will now only
notify the reply object to interrupt its wait cycle. This can cause
a slight delay in the removal, but that's no concern.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: limit trace to valid data of command request
Julian Wiedmann [Tue, 12 Feb 2019 17:33:20 +0000 (18:33 +0100)]
s390/qeth: limit trace to valid data of command request

'len' specifies how much data we send to the HW, don't dump beyond this
boundary.
As of today this is no big concern - commands are built in full, zeroed
pages.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: align csum offload with TSO control logic
Julian Wiedmann [Tue, 12 Feb 2019 17:33:19 +0000 (18:33 +0100)]
s390/qeth: align csum offload with TSO control logic

csum offload and TSO have similar programming requirements. The TSO code
was reworked with commit "s390/qeth: enhance TSO control sequence",
adjust the csum control flow accordingly. Primarily this means replacing
custom helpers with more generic infrastructure.

Also, change the LP2LP check so that it warns on TX offload (not RX).
This is where reduced csum capability actually matters.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: enable only required csum offload features
Julian Wiedmann [Tue, 12 Feb 2019 17:33:18 +0000 (18:33 +0100)]
s390/qeth: enable only required csum offload features

Current code attempts to enable all advertised HW csum offload features.
Future-proof this by enabling only those features that we actually use.

Also, the IPv4 header csum feature is only needed for TX on L3 devices.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: consolidate filling of low-level cmd length fields
Julian Wiedmann [Tue, 12 Feb 2019 17:33:17 +0000 (18:33 +0100)]
s390/qeth: consolidate filling of low-level cmd length fields

The code to fill the IPA length fields is duplicated three times across
the driver:
1. qeth_send_ipa_cmd() sets IPA_CMD_LENGTH, which matches the defaults
   in the IPA_PDU_HEADER template.
2. for OSN, qeth_osn_send_ipa_cmd() bypasses this logic and inserts the
   length passed by the caller.
3. SNMP commands (that can outgrow IPA_CMD_LENGTH) have their own way
   of setting the length fields, via qeth_send_ipa_snmp_cmd().

Consolidate this into qeth_prepare_ipa_cmd(), which all originators of
IPA cmds already call during setup of their cmd. Let qeth_send_ipa_cmd()
pull the length from the cmd instead of hard-coding IPA_CMD_LENGTH.

For now, the SNMP code still needs to fix-up its length fields manually.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agos390/qeth: reduce data length for ARP cache query
Julian Wiedmann [Tue, 12 Feb 2019 17:33:16 +0000 (18:33 +0100)]
s390/qeth: reduce data length for ARP cache query

qeth_l3_query_arp_cache_info() indicates a data length that's much
larger than the actual length of its request (ie. the value passed to
qeth_get_setassparms_cmd()). The confusion presumably comes from the
fact that the cmd _response_ can be quite large - but that's no concern
for the initial request IO.

Fixing this up allows us to use the generic qeth_send_ipa_cmd()
infrastructure.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'Add-ENETC-PTP-clock-driver'
David S. Miller [Tue, 12 Feb 2019 17:58:48 +0000 (12:58 -0500)]
Merge branch 'Add-ENETC-PTP-clock-driver'

Yangbo Lu says:

====================
Add ENETC PTP clock driver

There is same QorIQ 1588 timer IP block on the new ENETC Ethernet
controller with eTSEC/DPAA Ethernet controllers. However it's
different endianness (little-endian) and using PCI driver.

To support ENETC PTP driver, ptp_qoriq driver needed to be
reworked to make functions global for reusing, to add little-
endian support, to add ENETC memory map support, and to add
ENETC dependency for ptp_qoriq driver.

In addition, although ENETC PTP driver is a PCI driver, the dts
node still could be used. Currently the ls1028a dtsi which is
the only platform by now using ENETC is not complete, so there
is still dependency for ENETC PTP node upstreaming. This will
be done in the near future. The hardware timestamping support
for ENETC is done but needs to be reworked with new method in
internal git tree, and will be sent out soon.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/mlx4_en: Force CHECKSUM_NONE for short ethernet frames
Saeed Mahameed [Mon, 11 Feb 2019 16:04:17 +0000 (18:04 +0200)]
net/mlx4_en: Force CHECKSUM_NONE for short ethernet frames

When an ethernet frame is padded to meet the minimum ethernet frame
size, the padding octets are not covered by the hardware checksum.
Fortunately the padding octets are usually zero's, which don't affect
checksum. However, it is not guaranteed. For example, switches might
choose to make other use of these octets.
This repeatedly causes kernel hardware checksum fault.

Prior to the cited commit below, skb checksum was forced to be
CHECKSUM_NONE when padding is detected. After it, we need to keep
skb->csum updated. However, fixing up CHECKSUM_COMPLETE requires to
verify and parse IP headers, it does not worth the effort as the packets
are so small that CHECKSUM_COMPLETE has no significant advantage.

Future work: when reporting checksum complete is not an option for
IP non-TCP/UDP packets, we can actually fallback to report checksum
unnecessary, by looking at cqe IPOK bit.

Fixes: 88078d98d1bb ("net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends")
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMAINTAINERS: add enetc_ptp driver into QorIQ PTP list
Yangbo Lu [Tue, 12 Feb 2019 04:24:04 +0000 (12:24 +0800)]
MAINTAINERS: add enetc_ptp driver into QorIQ PTP list

This patch to add enetc_ptp driver into QorIQ PTP list
for maintaining.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoenetc: add PTP clock driver
Yangbo Lu [Tue, 12 Feb 2019 04:24:03 +0000 (12:24 +0800)]
enetc: add PTP clock driver

This patch is to add PTP clock driver for ENETC.
The driver reused QorIQ PTP clock driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoptp: add QorIQ PTP support for ENETC
Yangbo Lu [Tue, 12 Feb 2019 04:24:02 +0000 (12:24 +0800)]
ptp: add QorIQ PTP support for ENETC

This patch is to add QorIQ PTP support for ENETC.
ENETC PTP driver which is a PCI driver for same
1588 timer IP block will reuse QorIQ PTP driver.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoptp_qoriq: fix register memory map
Yangbo Lu [Tue, 12 Feb 2019 04:24:01 +0000 (12:24 +0800)]
ptp_qoriq: fix register memory map

The 1588 timer on eTSEC Ethernet controller uses different
register memory map with DPAA Ethernet controller.
Now the new ENETC Ethernet controller uses same reigster
memory map with DPAA. To support ENETC, let's use register
memory map of DPAA/ENETC in default.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodt-binding: ptp_qoriq: add little-endian support
Yangbo Lu [Tue, 12 Feb 2019 04:24:00 +0000 (12:24 +0800)]
dt-binding: ptp_qoriq: add little-endian support

Specify "little-endian" property if the 1588 timer IP block
is little-endian mode. The default endian mode is big-endian.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoptp_qoriq: add little enadian support
Yangbo Lu [Tue, 12 Feb 2019 04:23:59 +0000 (12:23 +0800)]
ptp_qoriq: add little enadian support

There is QorIQ 1588 timer IP block on the new ENETC Ethernet
controller. However it uses little endian mode which is different
with before. This patch is to add little endian support for the
driver by using "little-endian" dts node property.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoptp_qoriq: convert to use ptp_qoriq_init/free
Yangbo Lu [Tue, 12 Feb 2019 04:23:58 +0000 (12:23 +0800)]
ptp_qoriq: convert to use ptp_qoriq_init/free

Moved QorIQ PTP clock initialization/free into new functions
ptp_qoriq_init()/ptp_qoriq_free(). These functions could also
be reused by ENETC PTP drvier which is a PCI driver for same
1588 timer IP block.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoptp_qoriq: make ptp operations global
Yangbo Lu [Tue, 12 Feb 2019 04:23:57 +0000 (12:23 +0800)]
ptp_qoriq: make ptp operations global

This patch is to make functions of ptp operations global,
so that ENETC PTP driver which is a PCI driver for same
1588 timer IP block could reuse them.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoptp_qoriq: make structure/function names more consistent
Yangbo Lu [Tue, 12 Feb 2019 04:23:56 +0000 (12:23 +0800)]
ptp_qoriq: make structure/function names more consistent

Strings containing "ptp_qoriq" or "qoriq_ptp" which were used for
structure/function names were complained by users. Let's just use
the unique "ptp_qoriq" to make these names more consistent.
This patch is just to unify the names using "ptp_qoriq". It hasn't
changed any functions.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/skbuff: fix up kernel-doc placement
Brian Norris [Mon, 11 Feb 2019 21:02:25 +0000 (13:02 -0800)]
net/skbuff: fix up kernel-doc placement

There are several skb_* functions where the locked and unlocked
functions are confusingly documented. For several of them, the
kernel-doc for the unlocked version is placed above the locked version,
which to the casual reader makes it seems like the locked version "takes
no locks and you must therefore hold required locks before calling it."

One can see, for example, that this link claims to document
skb_queue_head(), while instead describing __skb_queue_head().

https://www.kernel.org/doc/html/latest/networking/kapi.html#c.skb_queue_head

The correct documentation for skb_queue_head() is also included further
down the page.

This diff tested via:

  $ scripts/kernel-doc -rst include/linux/skbuff.h net/core/skbuff.c

No new warnings were seen, and the output makes a little more sense.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS-get-remove'
David S. Miller [Tue, 12 Feb 2019 17:49:53 +0000 (12:49 -0500)]
Merge branch 'SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS-get-remove'

Florian Fainelli says:

====================
Remove getting SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS

AFAICT there is no code that attempts to get the value of the attribute
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS while it is used with
switchdev_port_attr_set().

This is effectively no doing anything and it can slow down future work
that tries to make modifications in these areas so remove that.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agostaging: fsl-dpaa2: ethsw: Remove getting PORT_BRIDGE_FLAGS
Florian Fainelli [Mon, 11 Feb 2019 21:17:49 +0000 (13:17 -0800)]
staging: fsl-dpaa2: ethsw: Remove getting PORT_BRIDGE_FLAGS

There is no code that tries to get the attribute
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS, remove support for doing that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agorocker: Remove getting PORT_BRIDGE_FLAGS
Florian Fainelli [Mon, 11 Feb 2019 21:17:48 +0000 (13:17 -0800)]
rocker: Remove getting PORT_BRIDGE_FLAGS

There is no code that attempts to get the
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS attribute, remove support for that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_switchdev: Remove getting PORT_BRIDGE_FLAGS
Florian Fainelli [Mon, 11 Feb 2019 21:17:47 +0000 (13:17 -0800)]
mlxsw: spectrum_switchdev: Remove getting PORT_BRIDGE_FLAGS

There is no code that will query the SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS
attribute remove support for that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: simplify genphy_config_eee_advert
Heiner Kallweit [Mon, 11 Feb 2019 21:16:13 +0000 (22:16 +0100)]
net: phy: simplify genphy_config_eee_advert

Use new function phy_modify_mmd_changed(), the result speaks for itself.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/tls: Do not use async crypto for non-data records
Vakul Garg [Mon, 11 Feb 2019 11:31:05 +0000 (11:31 +0000)]
net/tls: Do not use async crypto for non-data records

Addition of tls1.3 support broke tls1.2 handshake when async crypto
accelerator is used. This is because the record type for non-data
records is not propagated to user application. Also when async
decryption happens, the decryption does not stop when two different
types of records get dequeued and submitted for decryption. To address
it, we decrypt tls1.2 non-data records in synchronous way. We check
whether the record we just processed has same type as the previous one
before checking for async condition and jumping to dequeue next record.

Fixes: 130b392c6cd6b ("net: tls: Add tls 1.3 support")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodevlink: use direct return of genlmsg_reply
Li RongQing [Mon, 11 Feb 2019 11:09:07 +0000 (19:09 +0800)]
devlink: use direct return of genlmsg_reply

This can remove redundant check

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: marvell: mvpp2: use mvpp2_is_xlg() helper elsewhere
Russell King [Mon, 11 Feb 2019 10:23:15 +0000 (10:23 +0000)]
net: marvell: mvpp2: use mvpp2_is_xlg() helper elsewhere

There are several places which make the decision whether to access the
XLGMAC vs GMAC that only check for PHY_INTERFACE_MODE_10GKR and not its
XAUI variant.  Switch these to use the new helper so that we have
consistency through the driver.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: marvell: mvpp2: add mvpp2_is_xlg() helper
Russell King [Mon, 11 Feb 2019 10:23:10 +0000 (10:23 +0000)]
net: marvell: mvpp2: add mvpp2_is_xlg() helper

Add a mvpp2_is_xlg() helper to identify whether the interface mode
should be using the XLGMAC rather than the GMAC.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phylink: add phylink_init_eee() helper
Russell King [Mon, 11 Feb 2019 11:46:06 +0000 (11:46 +0000)]
net: phylink: add phylink_init_eee() helper

Provide phylink_init_eee() to allow MAC drivers to initialise PHY EEE
from within the ethtool set_eee() method.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phylink: only call mac_config() during resolve when link is up
Russell King [Mon, 11 Feb 2019 11:46:01 +0000 (11:46 +0000)]
net: phylink: only call mac_config() during resolve when link is up

There's little point calling mac_config() when the link is down.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoRevert "devlink: Add a generic wake_on_lan port parameter"
Vasundhara Volam [Mon, 11 Feb 2019 09:16:17 +0000 (14:46 +0530)]
Revert "devlink: Add a generic wake_on_lan port parameter"

This reverts commit b639583f9e36d044ac1b13090ae812266992cbac.

As per discussion with Jakub Kicinski and Michal Kubecek,
this will be better addressed by soon-too-come ethtool netlink
API with additional indication that given configuration request
is supposed to be persisted.

Also, remove the parameter support from bnxt_en driver.

Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Michael Chan <michael.chan@broadcom.com>
Cc: Michal Kubecek <mkubecek@suse.cz>
Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-DMA-API'
David S. Miller [Tue, 12 Feb 2019 17:09:24 +0000 (12:09 -0500)]
Merge branch 'net-DMA-API'

Christoph Hellwig says:

====================
net: don't pass a NULL struct device to DMA API functions v2

We still have a few drivers which pass a NULL struct device pointer
to DMA API functions, which generally is a bad idea as the API
implementations rely on the device not only for ops selection, but
also the dma mask and various other attributes.

This series contains all easy conversions to pass a struct device,
besides that there also is some arch code that needs separate handling,
a driver that should not use the DMA API at all, and one that is
a complete basket case to be deal with separately.

Changes since v1:
 - fix an inverted ifdef in CAIF
 - update the smc911x changelog
 - split the series, this only contains the networking patches
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agosmc911x: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:20:04 +0000 (14:20 +0100)]
smc911x: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Note that smc911x apparently is a PIO chip with an external DMA
handshake, and we probably use the wrong device here.  But at least
it matches the mapping side, which apparently works or at least
worked in the not too distant past.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agometh: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:20:03 +0000 (14:20 +0100)]
meth: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Also use GFP_KERNEL instead of GFP_ATOMIC as the gfp_t for the memory
allocation, as we aren't in interrupt context or under a lock.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomoxart_ether: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:20:02 +0000 (14:20 +0100)]
moxart_ether: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agopxa168_eth: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:20:01 +0000 (14:20 +0100)]
pxa168_eth: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Note that this driver seems to entirely lack dma_map_single error
handling, but that is left for another time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agolantiq_etop: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:20:00 +0000 (14:20 +0100)]
lantiq_etop: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Note this driver seems to lack dma_unmap_* calls entirely, but fixing
that is left for another time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomacb_main: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:19:59 +0000 (14:19 +0100)]
macb_main: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoau1000_eth: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:19:58 +0000 (14:19 +0100)]
au1000_eth: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: caif: pass struct device to DMA API functions
Christoph Hellwig [Mon, 11 Feb 2019 13:19:57 +0000 (14:19 +0100)]
net: caif: pass struct device to DMA API functions

The DMA API generally relies on a struct device to work properly, and
only barely works without one for legacy reasons.  Pass the easily
available struct device from the platform_device to remedy this.

Also use the proper Kconfig symbol to check for DMA API availability.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mlxsw-Several-updates'
David S. Miller [Tue, 12 Feb 2019 17:03:29 +0000 (12:03 -0500)]
Merge branch 'mlxsw-Several-updates'

Ido Schimmel says:

====================
mlxsw: Several updates

Patches #1-#3 contain misc updates for the mlxsw driver, one of which is
a fix following recent introduction of flow_rule infrastructure.

Patch #4 avoids double sourcing of lib.sh in forwarding selftests.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoselftests: mlxsw: avoid double sourcing of lib.sh
Jiri Pirko [Tue, 12 Feb 2019 16:29:54 +0000 (16:29 +0000)]
selftests: mlxsw: avoid double sourcing of lib.sh

Don't source lib.sh 2 times and make the script work with ifnames
passed on the command line.

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>
5 years agomlxsw: spectrum_flower: Fix VLAN modify action support
Ido Schimmel [Tue, 12 Feb 2019 16:29:53 +0000 (16:29 +0000)]
mlxsw: spectrum_flower: Fix VLAN modify action support

The driver does not support VLAN push and pop, but only VLAN modify.

Fixes: 738678817573 ("drivers: net: use flow action infrastructure")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum_router: Drop unnecessary WARN_ON_ONCE()
Ido Schimmel [Tue, 12 Feb 2019 16:29:52 +0000 (16:29 +0000)]
mlxsw: spectrum_router: Drop unnecessary WARN_ON_ONCE()

In case the register access failed an error would be logged anyway, so
we can drop the warning.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agomlxsw: spectrum: Set LAG port collector only when active
Nir Dotan [Tue, 12 Feb 2019 16:29:51 +0000 (16:29 +0000)]
mlxsw: spectrum: Set LAG port collector only when active

The LAG port collecting (receive) function was mistakenly set when the
port was registered as a LAG member, while it should be set only when
the port collection state is set to true. Set LAG port to collecting
when it is set to distributing, as described in the IEEE link
aggregation standard coupled control mux machine state diagram.

Signed-off-by: Nir Dotan <nird@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>
5 years agoMerge branch 'net-smc-next'
David S. Miller [Tue, 12 Feb 2019 16:59:45 +0000 (11:59 -0500)]
Merge branch 'net-smc-next'

Ursula Braun says:

====================
net/smc: patches 2019-02-12

here are patches for SMC:
* patches 1 and 3 optimize SMC-R tx logic
* patch 2 is a cleanup without functional change
* patch 4 optimizes rx logic
* patches 5 and 6 improve robustness in link group and IB event handling
* patch 7 establishes Karsten Graul as another SMC maintainer
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMAINTAINERS: add Karsten as SMC maintainer
Ursula Braun [Tue, 12 Feb 2019 15:29:56 +0000 (16:29 +0100)]
MAINTAINERS: add Karsten as SMC maintainer

Add Karsten as additional maintainer for Shared Memory Communications
(SMC) Sockets.

Acked-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/smc: check port_idx of ib event
Karsten Graul [Tue, 12 Feb 2019 15:29:55 +0000 (16:29 +0100)]
net/smc: check port_idx of ib event

For robustness protect of higher port numbers than expected to avoid
setting bits behind our port_event_mask. In case of an DEVICE_FATAL
event all ports must be checked. The IB_EVENT_GID_CHANGE event is
provided in the global event handler, so handle it there. And handle a
QP_FATAL event instead of an DEVICE_FATAL event in the qp handler.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/smc: check connections in smc_lgr_free_work
Karsten Graul [Tue, 12 Feb 2019 15:29:54 +0000 (16:29 +0100)]
net/smc: check connections in smc_lgr_free_work

Remove the shortcut that smc_lgr_free() would skip the check for
existing connections when the link group is not in the link group list.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/smc: reduce amount of status updates to peer
Karsten Graul [Tue, 12 Feb 2019 15:29:53 +0000 (16:29 +0100)]
net/smc: reduce amount of status updates to peer

In smc_cdc_msg_recv_action() the received cdc message is evaluated.
To reduce the number of messaged triggered by this evaluation the logic
is streamlined. For the write_blocked condition we do not need to send
a response immediately. The remaining conditions can be put together
into one if clause.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/smc: no delay for free tx buffer wait
Karsten Graul [Tue, 12 Feb 2019 15:29:52 +0000 (16:29 +0100)]
net/smc: no delay for free tx buffer wait

When no free transfer buffers are available then a work to call
smc_tx_work() is scheduled. Set the schedule delay to zero, because for
the out-of-buffers condition the work can start immediately and will
block in the called function smc_wr_tx_get_free_slot(), waiting for free
buffers.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/smc: move wake up of close waiter
Karsten Graul [Tue, 12 Feb 2019 15:29:51 +0000 (16:29 +0100)]
net/smc: move wake up of close waiter

Move the call to smc_close_wake_tx_prepared() (which wakes up a possibly
waiting close processing that might wait for 'all data sent') to
smc_tx_sndbuf_nonempty() (which is the main function to send data).

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/smc: reset cursor update required flag
Karsten Graul [Tue, 12 Feb 2019 15:29:50 +0000 (16:29 +0100)]
net/smc: reset cursor update required flag

When an updated rx_cursor_confirmed field was sent to the peer then
reset the cons_curs_upd_req flag. And remove the duplicate reset and
cursor update in smc_tx_consumer_update().

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonfp: flower: remove double new line
Jakub Kicinski [Tue, 12 Feb 2019 08:18:02 +0000 (00:18 -0800)]
nfp: flower: remove double new line

Recent cls_flower offload rewrite added a double new line.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoflow_offload: Fix flow action infrastructure
Eli Britstein [Mon, 11 Feb 2019 07:52:59 +0000 (09:52 +0200)]
flow_offload: Fix flow action infrastructure

Implementation of macro "flow_action_for_each" introduced in
commit e3ab786b42535 ("flow_offload: add flow action infrastructure")
and used in commit 738678817573c ("drivers: net: use flow action
infrastructure") iterated the first item twice and did not reach the
last one. Fix it.

Fixes: e3ab786b42535 ("flow_offload: add flow action infrastructure")
Fixes: 738678817573c ("drivers: net: use flow action infrastructure")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoDocumentation: fix some freescale dpio-driver.rst warnings
Randy Dunlap [Mon, 11 Feb 2019 06:32:42 +0000 (22:32 -0800)]
Documentation: fix some freescale dpio-driver.rst warnings

Fix markup warnings for one list by using correct list syntax.
Fix markup warnings for another list by using blank lines before the
list.

Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst:30: WARNING: Unexpected indentation.
Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst:143: WARNING: Unexpected indentation.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Stuart Yoder <stuyoder@gmail.com>
Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Cc: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Cc: netdev@vger.kernel.org
Cc: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'devinfo-tweaks'
David S. Miller [Tue, 12 Feb 2019 04:39:56 +0000 (20:39 -0800)]
Merge branch 'devinfo-tweaks'

Jakub Kicinski says:

====================
devlink: minor tweaks to reported device info

This series contains two minor touch ups for devlink code. First
|| is corrected to && in the ethtool compat code. Next patch
decreases the stack allocation size.

On the nfp side after further discussions with the manufacturing
team we decided to realign the serial number contents slightly and
rename one of the other fields from "vendor" to "mfr", short for
"manufacture".

v2: - add patch 3 - move board maker as a generic attribute.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonfp: devlink: include vendor/product info in serial number
Jakub Kicinski [Mon, 11 Feb 2019 03:35:31 +0000 (19:35 -0800)]
nfp: devlink: include vendor/product info in serial number

The manufacturing team requests we include vendor and product
in the serial number field, as the serial number itself is not
unique across manufacturing facilities and products.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonfp: devlink: use the generic manufacture identifier instead of vendor
Jakub Kicinski [Mon, 11 Feb 2019 03:35:30 +0000 (19:35 -0800)]
nfp: devlink: use the generic manufacture identifier instead of vendor

Vendor may sound ambiguous, let's rename the fab string to
"board.manufacture" (which was just added as a generic identifier).

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodevlink: add a generic board.manufacture version name
Jakub Kicinski [Mon, 11 Feb 2019 03:35:29 +0000 (19:35 -0800)]
devlink: add a generic board.manufacture version name

At Jiri's suggestion add a generic "board.manufacture"
version identifier.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodevlink: don't allocate attrs on the stack
Jakub Kicinski [Mon, 11 Feb 2019 03:35:28 +0000 (19:35 -0800)]
devlink: don't allocate attrs on the stack

Number of devlink attributes has grown over 128, causing the
following warning:

../net/core/devlink.c: In function ‘devlink_nl_cmd_region_read_dumpit’:
../net/core/devlink.c:3740:1: warning: the frame size of 1064 bytes is larger than 1024 bytes [-Wframe-larger-than=]
 }
  ^

Since the number of attributes is only going to grow allocate
the array dynamically.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodevlink: fix condition for compat device info
Jakub Kicinski [Mon, 11 Feb 2019 03:35:27 +0000 (19:35 -0800)]
devlink: fix condition for compat device info

We need the port to be both ethernet and have the rigth netdev,
not one or the other.

Fixes: ddb6e99e2db1 ("ethtool: add compat for devlink info")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agodevlink: Add WARN_ON to catch errors of not cleaning devlink objects
Parav Pandit [Fri, 8 Feb 2019 21:15:00 +0000 (15:15 -0600)]
devlink: Add WARN_ON to catch errors of not cleaning devlink objects

Add WARN_ON to make sure that all sub objects of a devlink device are
cleanedup before freeing the devlink device.
This helps to catch any driver bugs.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dsa: microchip: add switch offload forwarding support
Tristram Ha [Fri, 8 Feb 2019 04:05:58 +0000 (20:05 -0800)]
net: dsa: microchip: add switch offload forwarding support

The flag offload_fwd_mark is set as the switch can forward frames by
itself.

This can be considered a fix to a problem introduced in commit
c2e866911e254067 where the port membership are not set in sync.  The flag
offload_fwd_mark just needs to be set in tag_ksz.c to prevent the software
bridge from forwarding duplicate multicast frames.

Fixes: c2e866911e254067 ("microchip: break KSZ9477 DSA driver into two files")
Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'net-phy-register-modifying-helpers'
David S. Miller [Sun, 10 Feb 2019 20:53:19 +0000 (12:53 -0800)]
Merge branch 'net-phy-register-modifying-helpers'

Heiner Kallweit says:

====================
net: phy: add and use register modifying helpers returning 1 on change

Add and use register modifying helpers returning 1 on change.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: use phy_modify_changed in genphy_config_advert
Heiner Kallweit [Sun, 10 Feb 2019 18:59:57 +0000 (19:59 +0100)]
net: phy: use phy_modify_changed in genphy_config_advert

Use phy_modify_changed() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: marvell10g: fix usage of new MMD modifying helpers
Heiner Kallweit [Sun, 10 Feb 2019 18:58:49 +0000 (19:58 +0100)]
net: phy: marvell10g: fix usage of new MMD modifying helpers

When replacing mv3310_modify() with phy_modify_mmd() we missed that
they behave differently, mv3310_modify() returns 1 on a changed
register value whilst phy_modify_mmd() returns 0. Fix this by replacing
phy_modify_mmd() with phy_modify_mmd_changed() where needed.

Fixes: b52c018ddccf ("net: phy: make use of new MMD accessors")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: add register modifying helpers returning 1 on change
Heiner Kallweit [Sun, 10 Feb 2019 18:57:56 +0000 (19:57 +0100)]
net: phy: add register modifying helpers returning 1 on change

When modifying registers there are scenarios where we need to know
whether the register content actually changed. This patch adds
new helpers to not break users of the current ones, phy_modify() etc.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'tc-action-identifier-consistency'
David S. Miller [Sun, 10 Feb 2019 17:28:43 +0000 (09:28 -0800)]
Merge branch 'tc-action-identifier-consistency'

Eli Cohen says:

====================
Change tc action identifiers to be more consistent

This two patch series modifies TC actions identifiers to be more consistent and
also puts them in one place so new identifiers numbers can be chosen more
easily.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
Eli Cohen [Sun, 10 Feb 2019 12:25:00 +0000 (14:25 +0200)]
net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE

Modify the kernel users of the TCA_ACT_* macros to use TCA_ID_*. For
example, use TCA_ID_GACT instead of TCA_ACT_GACT. This will align with
TCA_ID_POLICE and also differentiates these identifier, used in struct
tc_action_ops type field, from other macros starting with TCA_ACT_.

To make things clearer, we name the enum defining the TCA_ID_*
identifiers and also change the "type" field of struct tc_action to
id.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: Move all TC actions identifiers to one place
Eli Cohen [Sun, 10 Feb 2019 12:24:59 +0000 (14:24 +0200)]
net: Move all TC actions identifiers to one place

Move all the TC identifiers to one place, to the same enum that defines
the identifier of police action. This makes it easier choose numbers for
new actions since they are now defined in one place. We preserve the
original values for binary compatibility. New IDs should be added inside
the enum.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: aquantia: add support for AQCS109
Nikita Yushchenko [Fri, 8 Feb 2019 21:12:23 +0000 (22:12 +0100)]
net: phy: aquantia: add support for AQCS109

Add support for the AQCS109. From software point of view,
it should be almost equivalent to AQR107.

v2:
- make Nikita the author
- document what I changed

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
[hkallweit1@gmail.com: use PHY_ID_MATCH_MODEL mascro]
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: dsa: mv88e6xxx: SERDES support 2500BaseT via external PHY
Andrew Lunn [Fri, 8 Feb 2019 21:25:44 +0000 (22:25 +0100)]
net: dsa: mv88e6xxx: SERDES support 2500BaseT via external PHY

By using an external PHY, ports 9 and 10 can support 2500BaseT.
So set this link mode in the mask when validating.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoadd snmp counter document
yupeng [Sat, 9 Feb 2019 22:46:18 +0000 (14:46 -0800)]
add snmp counter document

add document for tcp retransmission, tcp fast open, syn cookies,
challenge ack, prune and several general counters

Signed-off-by: yupeng <yupeng0921@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: marvell: mvpp2: clear flow control modes in 10G mode
Russell King [Sat, 9 Feb 2019 16:06:51 +0000 (16:06 +0000)]
net: marvell: mvpp2: clear flow control modes in 10G mode

When mvpp2 configures the flow control modes in mvpp2_xlg_config() for
10G mode, it only ever set the flow control enable bits.  There is no
mechanism to clear these bits, which means that userspace is unable to
use standard APIs to disable flow control (the only way is to poke the
register directly.)

Fix the missing bit clearance to allow flow control to be disabled.
This means that, by default, as there is no negotiation in 10G modes
with mvpp2, flow control is now disabled rather than being rx-only.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: Add support for asking the PHY its abilities
Andrew Lunn [Sat, 9 Feb 2019 14:24:47 +0000 (15:24 +0100)]
net: phy: Add support for asking the PHY its abilities

Add support for runtime determination of what the PHY supports, by
adding a new function to the phy driver. The get_features call should
set the phydev->supported member with the features the PHY supports.
It is only called if phydrv->features is NULL.

This requires minor changes to pause. The PHY driver should not set
pause abilities, except for when it has odd cause capabilities, e.g.
pause cannot be disabled. With this change, phydev->supported already
contains the drivers abilities, including pause. So rather than
considering phydrv->features, look at the phydev->supported, and
enable pause if neither of the pause bits are already set.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
[hkallweit1@gmail.com: fixed small checkpatch complaint in one comment]
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: probe the PHY before determining the supported features
Andrew Lunn [Sat, 9 Feb 2019 13:46:30 +0000 (14:46 +0100)]
net: phy: probe the PHY before determining the supported features

We will soon support asking the PHY at runtime to determine what
features it supports, rather than forcing it to be compile time.
But we should probe the PHY first. So probe the phy driver earlier.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: remove unneeded masking of PHY register read results
Heiner Kallweit [Sat, 9 Feb 2019 08:46:53 +0000 (09:46 +0100)]
net: phy: remove unneeded masking of PHY register read results

PHY registers are only 16 bits wide, therefore, if the read was
successful, there's no need to mask out the higher 16 bits.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet/tls: Disable async decrytion for tls1.3
Vakul Garg [Sat, 9 Feb 2019 07:53:28 +0000 (07:53 +0000)]
net/tls: Disable async decrytion for tls1.3

Function tls_sw_recvmsg() dequeues multiple records from stream parser
and decrypts them. In case the decryption is done by async accelerator,
the records may get submitted for decryption while the previous ones may
not have been decryted yet. For tls1.3, the record type is known only
after decryption. Therefore, for tls1.3, tls_sw_recvmsg() may submit
records for decryption even if it gets 'handshake' records after 'data'
records. These intermediate 'handshake' records may do a key updation.
By the time new keys are given to ktls by userspace, it is possible that
ktls has already submitted some records i(which are encrypted with new
keys) for decryption using old keys. This would lead to decrypt failure.
Therefore, async decryption of records should be disabled for tls1.3.

Fixes: 130b392c6cd6b ("net: tls: Add tls 1.3 support")
Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg
Heiner Kallweit [Fri, 8 Feb 2019 18:25:22 +0000 (19:25 +0100)]
net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg

Bit 0 in register 1.5 doesn't represent a device but is a flag that
Clause 22 registers are present. Therefore disregard this bit when
populating the device list. If code needs this information it
should read register 1.5 directly instead of accessing the device
list.
Because this bit doesn't represent a device don't define a
MDIO_MMD_XYZ constant, just define a MDIO_DEVS_XYZ constant for
the flag in the device list bitmap.

v2:
- make masking of bit 0 more explicit
- improve commit message

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agoMerge branch 'mvpp2-phylink-fixes'
David S. Miller [Sat, 9 Feb 2019 07:08:39 +0000 (23:08 -0800)]
Merge branch 'mvpp2-phylink-fixes'

Russell King says:

====================
mvpp2 phylink fixes

Having spent a while debugging issues with Sven Auhagen, it appears
that the mvpp2 network driver's phylink support isn't quite correct.

This series fixes that up, but, despite being tested locally, by
Sven, and by Antoine, I would prefer it to be applied to net-next
so that there is time for more people to test before it hits -rc or
stable backports.

The symptoms were that although PHYs would come up, the GMAC never
reported that the link was up, or in some cases it did report link
up but packets would not flow.  Various approaches were tried to
work around that, such as switching to in-band negotiation from
PHY mode, but ultimately the problem was in the way mvpp2 was being
programmed.

This series addresses that by, essentially, making mvpp2 follow the
same implementation pattern as mvneta: we configure the GMAC in three
stages:

1) the PHY interface mode
2) the negotiation advert
3) the negotiation style

Another issue is that mvpp2 was always taking the link down each time
its mac_config method was called: this is disruptive when the link is
already up, and we're just updating settings such as flow control.
There are some circumstances where we make the call despite there
being no changes (eg, when phylink is polling a GPIO or using a custom
link state function.)

This series depends on two previous patches already sent for net-next:
  net: marvell: mvpp2: fix lack of link interrupts
  net: marvell: mvpp2: use phy_interface_mode_is_8023z() helper

There is one last patch which deals with link status interrupts, which
I'll send separately because I think there's other considerations, but
that should not hold up this series of patches.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
5 years agonet: marvell: mvpp2: fix AN restart
Russell King [Fri, 8 Feb 2019 15:35:59 +0000 (15:35 +0000)]
net: marvell: mvpp2: fix AN restart

phylink already limits which interface modes are able to call the
MACs AN restart function, but in any case, the commentry seems
incorrect: the AN restart bit does not automatically clear when
set.  This has been found via manual setting using devmem2, and
we can observe that the AN does indeed restart and complete, yet
the AN restart bit remains set.  Explicitly clear the AN restart
bit.

Tested-by: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>