summaryrefslogtreecommitdiffstats
path: root/drivers/s390/net
AgeCommit message (Collapse)Author
2020-12-07s390/qeth: make qeth_qdio_handle_aob() more robustJulian Wiedmann
When qeth_qdio_handle_aob() frees dangling allocations in the notified TX buffer, there are rare tear-down cases where qeth_drain_output_queue() would later call qeth_clear_output_buffer() for the same buffer - and thus end up walking the buffer a second time to check for dangling kmem_cache allocations. Luckily current code previously scrubs such a buffer, so qeth_clear_output_buffer() would find buf->buffer->element[i].addr as NULL and not do anything. But this is fragile, and we can easily improve it by consistently clearing the ->is_header flag after freeing the allocation. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-12-07s390/qeth: remove QETH_QDIO_BUF_HANDLED_DELAYED stateJulian Wiedmann
Reuse the QETH_QDIO_BUF_EMPTY state to indicate that a TX buffer has been completed with a QAOB notification, and may be cleaned up by qeth_cleanup_handled_pending(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-12-07s390/qeth: don't replace a fully completed async TX bufferJulian Wiedmann
For TX buffers that require an additional async notification via QAOB, the TX completion code can now manage all the necessary processing if the notification has already occurred (or is occurring concurrently). In such cases we can avoid replacing the metadata that is associated with the buffer's slot on the ring, and just keep using the current one. As qeth_clear_output_buffer() will also handle any kmem cache-allocated memory that was mapped into the TX buffer, qeth_qdio_handle_aob() doesn't need to worry about it. While at it, also remove the unneeded forward declaration for qeth_init_qdio_out_buf(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-12-07s390/qeth: use dev->groups for common sysfs attributesJulian Wiedmann
All qeth devices have a minimum set of sysfs attributes, and non-OSN devices share a group of additional attributes. Depending on whether the device is forced to use a specific discipline, the device_type then specifies further attributes. Shift the common attributes into dev->groups, so that the device_type only contains the discipline-specific attributes. This avoids exposing the common attributes to the disciplines, and nicely cleans up our sysfs code. While replacing the qeth_l*_*_device_attributes() helpers, switch from sysfs_*_groups() to the more generic device_*_groups(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-12-07s390/qeth: don't call INIT_LIST_HEAD() on iob's list entryJulian Wiedmann
INIT_LIST_HEAD() only needs to be called on actual list heads. While at it clarify the naming of the field. Suggested-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-12-01s390/ctcm: Use GFP_ATOMIC in ctcmpc_tx().Sebastian Andrzej Siewior
gfp_type() uses in_interrupt() to figure out the correct GFP mask. The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. ctcmpc_tx() is used as net_device_ops::ndo_start_xmit. This callback is invoked with disabled bottom halves. Use GFP_ATOMIC for memory allocation in ctcmpc_tx(). Remove gfp_type() since the last user is gone. Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-01s390/ctcm: Use GFP_KERNEL in add_channel().Sebastian Andrzej Siewior
gfp_type() uses in_interrupt() to figure out the correct GFP mask. The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. The memory allocation of `ch' a few lines above is using GFP_KERNEL, also an allocation a few lines later is using GFP_KERNEL. Use GFP_KERNEL for the memory allocation. Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-01s390/ctcm: Use explicit allocation mask in ctcmpc_unpack_skb().Sebastian Andrzej Siewior
gfp_type() uses in_interrupt() to figure out the correct GFP mask. The usage of in_interrupt() in drivers is phased out and Linus clearly requested that code which changes behaviour depending on context should either be separated or the context be conveyed in an argument passed by the caller, which usually knows the context. The call chain of ctcmpc_unpack_skb(): ctcmpc_bh() -> ctcmpc_unpack_skb() ctcmpc_bh() is a tasklet handler so GFP_ATOMIC is needed. Use GFP_ATOMIC as allocation type in ctcmpc_unpack_skb(). Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-01s390/ctcm: Avoid temporary allocation of struct pdu.Sebastian Andrzej Siewior
The size of struct pdu is 8 byte. The memory is allocated, initialized, used and deallocated a few lines later. It is more efficient to avoid the allocation/free dance and assign the values directly to skb's data part instead of using memcpy() for it. Avoid an allocation of struct pdu and use the resulting skb pointer instead. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [jwi: Fix-up the pdu_offset, adjust skb->len for the pushed length. Reflow the commit msg.] Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-01s390/ctcm: Avoid temporary allocation of struct qllc.Sebastian Andrzej Siewior
The size of struct qllc is 2 byte. The memory for is allocated, initialized, used and deallocated a few lines later. It is more efficient to avoid the allocation/free dance and assign the values directly to skb's data part instead of using memcpy() for it. Avoid an allocation of struct qllc and use the resulting skb pointer instead. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [jwi: remove a newline, reflow the commit msg] Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-01s390/ctcm: Avoid temporary allocation of struct th_header and th_sweep.Sebastian Andrzej Siewior
The size of struct th_header is 8 byte and the size of struct th_sweep is 16 byte. The memory for is allocated, initialized, used and deallocated a few lines later. It is more efficient to avoid the allocation/free dance and assign the values directly to skb's data part instead of using memcpy() for it. Avoid an allocation of struct th_sweep/th_header and use the resulting skb pointer instead. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> [jwi: use skb_put_zero(), instead of skb_put() + memset to 0] Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-27Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski
Trivial conflict in CAN, keep the net-next + the byteswap wrapper. Conflicts: drivers/net/can/usb/gs_usb.c Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20s390/qeth: fix tear down of async TX buffersJulian Wiedmann
When qeth_iqd_tx_complete() detects that a TX buffer requires additional async completion via QAOB, it might fail to replace the queue entry's metadata (and ends up triggering recovery). Assume now that the device gets torn down, overruling the recovery. If the QAOB notification then arrives before the tear down has sufficiently progressed, the buffer state is changed to QETH_QDIO_BUF_HANDLED_DELAYED by qeth_qdio_handle_aob(). The tear down code calls qeth_drain_output_queue(), where qeth_cleanup_handled_pending() will then attempt to replace such a buffer _again_. If it succeeds this time, the buffer ends up dangling in its replacement's ->next_pending list ... where it will never be freed, since there's no further call to qeth_cleanup_handled_pending(). But the second attempt isn't actually needed, we can simply leave the buffer on the queue and re-use it after a potential recovery has completed. The qeth_clear_output_buffer() in qeth_drain_output_queue() will ensure that it's in a clean state again. Fixes: 72861ae792c2 ("qeth: recovery through asynchronous delivery") Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20s390/qeth: fix af_iucv notification raceJulian Wiedmann
The two expected notification sequences are 1. TX_NOTIFY_PENDING with a subsequent TX_NOTIFY_DELAYED_*, when our TX completion code first observed the pending TX and the QAOB then completes at a later time; or 2. TX_NOTIFY_OK, when qeth_qdio_handle_aob() picked up the QAOB completion before our TX completion code even noticed that the TX was pending. But as qeth_iqd_tx_complete() and qeth_qdio_handle_aob() can run concurrently, we may end up with a race that results in a sequence of TX_NOTIFY_DELAYED_* followed by TX_NOTIFY_PENDING. Which would confuse the af_iucv code in its tracking of pending transmits. Rework the notification code, so that qeth_qdio_handle_aob() defers its notification if the TX completion code is still active. Fixes: b333293058aa ("qeth: add support for af_iucv HiperSockets transport") Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20s390/qeth: make af_iucv TX notification call more robustJulian Wiedmann
Calling into socket code is ugly already, at least check whether we are dealing with the expected sk_family. Only looking at skb->protocol is bound to cause troubles (consider eg. af_packet). Fixes: b333293058aa ("qeth: add support for af_iucv HiperSockets transport") Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-20s390/qeth: Remove pnso workaroundAlexandra Winter
Remove workaround that supported early hardware implementations of PNSO OC3. Rely on the 'enarf' feature bit instead. Fixes: fa115adff2c1 ("s390/qeth: Detect PNSO OC3 capability") Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> [jwi: use logical instead of bit-wise AND] Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: improve selection of ethtool link modesJulian Wiedmann
The link mode is a combination of port speed and port mode. But we currently only consider the speed, and then typically select the corresponding TP-based link mode. For 1G and 10G Fibre links this means we display the wrong link modes. Move the SPEED_* switch statements inside the PORT_* cases, and only consider valid combinations where we can select the corresponding link mode. Add the relevant link modes (1000baseX, 10000baseSR and 1000baseLR) that were introduced back with commit 5711a9822144 ("net: ethtool: add support for 1000BaseX and missing 10G link modes"). To differentiate between 10000baseSR and 10000baseLR, use the detailed media_type information that QUERY OAT provides. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: use QUERY OAT for initial link infoJulian Wiedmann
Improve the initial link info with data obtained from QUERY OAT. Doing so _only_ at initialization time avoids 1. dealing with multi-part replies, and 2. sifting through all the data that may get returned at runtime. This allows us to determine the correct port type for the 1000BT variant of recent OSA adapter generations (where the .card_type field in QUERY CARD INFO is no longer sufficient). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: clean up default cases for ethtool link modeJulian Wiedmann
Remove the default case for PORT_* and SPEED_* in our ethtool code. The only time these could be hit is if qeth_init_link_info() was unable to determine the port type from an OSA adapter's link_type. We already throw a message in this case, so reduce the noise and don't report bad data (ie. it's much more likely that any future link_type will represent a PORT_FIBRE link ...). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: set static link info during initializationJulian Wiedmann
Hard-code the minimal link info at initialization time, after we obtained the link_type. qeth_get_link_ksettings() can still override this with more accurate data from QUERY CARD INFO later on. Don't set arbitrary defaults for unknown OSA link types, they certainly won't match any future type. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: improve QUERY CARD INFO processingJulian Wiedmann
Move all the HW reply data parsing into qeth_query_card_info_cb(), and use common ethtool enums for transporting the information back to the caller. Also only look at the .port_speed field when we couldn't determine the speed from the .card_type field, and introduce some 'default' cases for SPEED_UNKNOWN, PORT_OTHER and DUPLEX_UNKNOWN. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: tolerate error when querying card infoJulian Wiedmann
By the time that our .get_link_ksettings() code issues a QUERY CARD INFO cmd to get link-related information, we already set up a good amount of static link data. Return this data when the cmd fails, same as when the cmd is not supported. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: remove useless if/elseKaixu Xia
Fix the following coccinelle report: ./drivers/s390/net/qeth_l3_main.c:107:2-4: WARNING: possible condition with no effect (if == else) Both branches are the same since commit ab29c480b194 ("s390/qeth: replace deprecated simple_stroul()"), so remove them. Reported-by: Tosk Robot <tencent_os_robot@tencent.com> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> [jwi: point to the commit that introduced this] Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-11-18s390/qeth: reduce rtnl locking for switchdev eventsJulian Wiedmann
call_switchdev_notifiers() doesn't require holding the RTNL lock since commit ff5cf100110c ("net: switchdev: Change notifier chain to be atomic"). We still need it for the "lost event" slow path, to avoid racing against a concurrent .ndo_bridge_setlink(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Reviewed-by: Alexandra Winter <wintera@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-10-26s390/ism: fix incorrect system EIDKarsten Graul
The system EID that is defined by the ISM driver is not correct. Using an incorrect system EID allows to communicate with remote Linux systems that use the same incorrect system EID, but when it comes to interoperability with other operating systems then the system EIDs do never match which prevents SMC-Dv2 communication. Using the correct system EID fixes this problem. Fixes: 201091ebb2a1 ("net/smc: introduce System Enterprise ID (SEID)") Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-10-02s390/ctcm: remove orphaned function declarationsVasily Gorbik
drivers/s390/net/ctcm_fsms.h: fsm_action_nop - only declaration left after commit 04885948b101 ("ctc: removal of the old ctc driver") drivers/s390/net/ctcm_mpc.h: ctcmpc_open - only declaration left after commit 293d984f0e36 ("ctcm: infrastructure for replaced ctc driver") Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-10-02s390/qeth: static checker cleanupsJulian Wiedmann
- Add/delete some blanks, white spaces and braces. - Fix misindentations. - Adjust a deprecated header include, and htons() conversion. - Remove extra 'return' statements. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-10-02s390/qeth: use netdev_name()Julian Wiedmann
Replace our custom version of netdev_name(). Once we started to allocate the netdev at probe time with commit d3d1b205e89f ("s390/qeth: allocate netdevice early"), this stopped working as intended anyway. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-10-02s390/qeth: constify the disciplinesJulian Wiedmann
The discipline struct is a fixed group of function pointers. So declare the L2 and L3 disciplines as constant. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-10-02s390/qeth: allow configuration of TX queues for OSA devicesJulian Wiedmann
For OSA devices that are _not_ configured in prio-queue mode, give users the option of selecting the number of active TX queues. This requires setting up the HW queues with a reasonable default QoS value in the QIB's PQUE parm area. As with the other device types, we bring up the device with a minimal number of TX queues for compatibility reasons. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-10-02s390/qeth: de-magic the QIB parm areaJulian Wiedmann
Use a proper struct, and only program the QIB extensions for devices where they are supported. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-10-02s390/qeth: keep track of wanted TX queuesJulian Wiedmann
When re-initializing a device, we can hit a situation where qeth_osa_set_output_queues() detects that it supports more or less HW TX queues than before. Right now we adjust dev->real_num_tx_queues from right there, but 1. it's getting more & more complicated to cover all cases, and 2. we can't re-enable the actually expected number of TX queues later because we lost the needed information. So keep track of the wanted TX queues (on initial setup, and whenever its changed via .set_channels), and later use that information when re-enabling the netdevice. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-28net/smc: introduce CHID callback for ISM devicesUrsula Braun
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>
2020-09-28net/smc: introduce System Enterprise ID (SEID)Ursula Braun
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>
2020-09-23s390/qeth: remove forward declarations in L2 codeJulian Wiedmann
Shuffle some code around (primarily all the discipline-related stuff) to get rid of all the unnecessary forward declarations. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: consolidate teardown codeJulian Wiedmann
Clarify which discipline-specific steps are needed to roll back after error in qeth_l?_set_online(), and which are common to roll back from qeth_hardsetup_card(). Some steps (cancelling the RX modeset, draining the TX queues) are only necessary if the netdev was potentially UP before, so move them to the common qeth_set_offline(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: consolidate online codeJulian Wiedmann
Move duplicated code from the disciplines into the core path. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: cancel cmds earlier during teardownJulian Wiedmann
Originators of cmd IO typically hold the rtnl or conf_mutex to protect against a concurrent teardown. Since qeth_set_offline() already holds the conf_mutex, the main reason why we still care about cancelling pending cmds is so that they release the rtnl when we need it ourselves. So move this step a little earlier into the teardown sequence. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: tighten ucast IP lockingJulian Wiedmann
The programming of ucast IPs via qeth_l3_modify_ip() is driven independently from any of our typical locking mechanisms (eg. detaching the netdevice, or holding the conf_mutex). So when we inspect the card state to check whether the required cmd IO should be deferred, there is no protection against concurrent state changes. But by slightly re-ordering the teardown sequence, we can rely on the ip_lock to sufficiently serialize things: 1. when running concurrently to qeth_l3_set_online(), any instance of qeth_l3_modify_ip() that aquires the ip_lock _after_ qeth_l3_recover_ip() will observe the state as CARD_STATE_SOFTSETUP and not defer the IO. 2. when running concurrently to qeth_l3_set_offline(), any instance of qeth_l3_modify_ip() that aquires the ip_lock _after_ qeth_l3_clear_ip_htable() will observe the state as CARD_STATE_DOWN and defer the IO. These guarantees in mind, we can now drop the conf_mutex from the qeth_l3_modify_rxip_vipa() wrapper. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: replace deprecated simple_stroul()Julian Wiedmann
Convert the remaining occurences in sysfs code to kstrtouint(). While at it move some input parsing out of locked sections, replace an open-coded clamp() and remove some unnecessary run-time checks for ipatoe->mask_bits that are already enforced when creating the object. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: clean up string ops in qeth_l3_parse_ipatoe()Julian Wiedmann
Indicate the max number of to-be-parsed characters, and avoid copying the address sub-string. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: relax locking for ipato config dataJulian Wiedmann
card->ipato is currently protected by the conf_mutex. But most users also hold the ip_lock - in particular qeth_l3_add_ip(). So slightly expand the sections under ip_lock in a few places (to effectively cover a few error & no-op cases), and then drop the conf_mutex where it's no longer needed. Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-23s390/qeth: don't init refcount twice for mcast IPsJulian Wiedmann
mcast IP objects are allocated within qeth_l3_add_mcast_rtnl(), with .ref_counter already set to 1 via qeth_l3_init_ipaddr(). Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-22Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller
Two minor conflicts: 1) net/ipv4/route.c, adding a new local variable while moving another local variable and removing it's initial assignment. 2) drivers/net/dsa/microchip/ksz9477.c, overlapping changes. One pretty prints the port mode differently, whilst another changes the driver to try and obtain the port mode from the port node rather than the switch node. Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-15s390/qeth: implement ndo_bridge_setlink for learning_syncAlexandra Winter
Documentation/networking/switchdev.txt and 'man bridge' indicate that the learning_sync bridge attribute is used to control whether a given device will sync MAC addresses learned on its device port to a master bridge FDB, where they will show up as 'extern_learn offload'. So we map qeth_l2_dev2br_an_set() to the learning_sync bridge link attribute. Turning off learning_sync will flush all extern_learn entries from the bridge fdb and all pending events from the card's work queue. When the hardware interface goes offline with learning_sync on (e.g. for HW recovery), all extern_learn entries will be flushed from the bridge fdb and all pending events from the card's work queue. When the interface goes online again, it will send new notifications for all then valid MACs. learning_sync attribute can not be modified while interface is offline. See 'commit e6e771b3d897 ("s390/qeth: detach netdevice while card is offline")' An alternative implementation would be to always offload the 'learning' attribute of a software bridge to the hardware interface attached to it and thus implicitly enable fdb notification. This was not chosen for 2 reasons: 1) In our case the software bridge is NOT a representation of a hardware switch. It is just connected to a smart NIC that is able to inform about the addresses attached to it. It is not necessarily using source MAC learning for this and other bridgeports can be attached to other NICs with different properties. 2) We want a means to enable this notification explicitly. There may be cases where a bridgeport is set to 'learning', but we do not want to enable the notification. Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-15s390/qeth: implement ndo_bridge_getlink for learning_syncAlexandra Winter
Documentation/networking/switchdev.txt and 'man bridge' indicate that the learning_sync bridge attribute is used to indicate whether a given device will sync MAC addresses learned on its device port to a master bridge FDB. learning_sync attribute can not be read while interface is offline (down). See 'commit e6e771b3d897 ("s390/qeth: detach netdevice while card is offline")' We return EOPNOTSUPP and not EONODEV in this case, because EONOTSUPP is the only rc that is tolerated by 'bridge -d link show'. Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-15s390/qeth: Reset address notification in case of buffer overflowAlexandra Winter
In case hardware sends more device-to-bridge-address-change notfications than the qeth-l2 driver can handle, the hardware will send an overflow event and then stop sending any events. It expects software to flush its FDB and start over again. Re-enabling address-change-notification will report all current addresses. In order to re-enable address-change-notification this patch defines the functions qeth_l2_dev2br_an_set() and qeth_l2_dev2br_an_set_cb to enable or disable dev-to-bridge-address-notification. A following patch will use the learning_sync bridgeport flag to trigger enabling or disabling of address-change-notification, so we define priv->brport_features to store the current setting. BRIDGE_INFO and ADDR_INFO functionality are mutually exclusive, whereas ADDR_INFO and qeth_l2_vnicc* can be used together. Alternative implementations to handle buffer overflow: Just re-enabling notification and adding all newly reported addresses would cover any lost 'add' events, but not the lost 'delete' events. Then these invalid addresses would stay in the bridge FDB as long as the device exists. Setting the net device down and up, would be an alternative, but is a bit drastic. If the net device has many secondary addresses this will create many delete/add events at its peers which could de-stabilize the network segment. Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-15s390/qeth: Translate address events into switchdev notifiersAlexandra Winter
A qeth-l2 HiperSockets card can show switch-ish behaviour in the sense, that it can report all MACs that are reachable via this interface. Just like a switch device, it can notify the software bridge about changes to its fdb. This patch exploits this device-to-bridge-notification and extracts the relevant information from the hardware events to generate notifications to an attached software bridge. There are 2 sources for this information: 1) The reply message of Perform-Network-Subchannel-Operations (PNSO) (operation code ADDR_INFO) reports all addresses that are currently reachable (implemented in a later patch). 2) As long as device-to-bridge-notification is enabled, hardware will generate address change notification events, whenever the content of the hardware fdb changes (this patch). The bridge_hostnotify feature (PNSO operation code BRIDGE_INFO) uses the same address change notification events. We need to distinguish between qeth_pnso_mode QETH_PNSO_BRIDGEPORT and QETH_PNSO_ADDR_INFO and call a different handler. In both cases deadlocks must be prevented, if the workqueue is drained under lock and QETH_PNSO_NONE, when notification is disabled. bridge_hostnotify generates udev events, there is no intend to do the same for dev2br. Instead this patch will generate SWITCHDEV_FDB_ADD_TO_BRIDGE and SWITCHDEV_FDB_DEL_TO_BRIDGE notifications, that will cause the software bridge to add (or delete) entries to its fdb as 'extern_learn offload'. Documentation/networking/switchdev.txt proposes to add "depends NET_SWITCHDEV" to driver's Kconfig. This is not done here, so even in absence of the NET_SWITCHDEV module, the QETH_L2 module will still be built, but then the switchdev notifiers will have no effect. No VLAN filtering is done on the entries and VLAN information is not passed on to the bridge fdb entries. This could be added later. For now VLAN interfaces can be defined on the upper bridge interface. Multicast entries are not passed on to the bridge fdb. This could be added later. For now mcast flooding can be used in the bridge. The card reports all MACs that are in its FDB, but we must not pass on MACs that are registered for this interface. Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-15s390/qeth: Detect PNSO OC3 capabilityAlexandra Winter
This patch detects whether device-to-bridge-notification, provided by the Perform Network Subchannel Operation (PNSO) operation code ADDR_INFO (OC3), is supported by this card. A following patch will map this to the learning_sync bridgeport flag, so we store it in priv->brport_hw_features in bridgeport flag format. Only IQD cards provide PNSO. There is a feature bit to indicate whether the machine provides OC3, unfortunately it is not set on old machines. So PNSO is called to find out. As this will disable notification and is exclusive with bridgeport_notification, this must be done during card initialisation before previous settings are restored. PNSO functionality requires some configuration values that are added to the qeth_card.info structure. Some helper functions are defined to fill them out when the card is brought online and some other places are adapted, that can also benefit from these fields. Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-15s390/cio: Add new Operation Code OC3 to PNSOAlexandra Winter
Add support for operation code 3 (OC3) of the Perform-Network-Subchannel-Operations (PNSO) function of the Channel-Subsystem-Call (CHSC) instruction. PNSO provides 2 operation codes: OC0 - BRIDGE_INFO OC3 - ADDR_INFO (new) Extend the function calls to *pnso* to pass the OC and add new response code 0108. Support for OC3 is indicated by a flag in the css_general_characteristics. Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>