aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/mcdi.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-01-10sfc: move various functionsAlex Maftei (amaftei)1-2/+0
Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-08sfc: add new headers in preparation for code splitAlex Maftei (amaftei)1-1/+0
New headers contain prototypes of functions that will be common between ef10 and upcoming driver. Removed static modifier from the affected functions. Some function prototypes were removed from existing headers. Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner1-4/+1
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-18sfc: support VI strides other than 8kEdward Cree1-0/+3
Medford2 can also have 16k or 64k VI stride. This is reported by MCDI in GET_CAPABILITIES, which fortunately is called before the driver does anything sensitive to the VI stride (such as accessing or even allocating VIs past the zeroth). Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-09sfc: configure UDP tunnel offload portsJon Cooper1-0/+1
Implement ndo_udp_tunnel_{add,del} to update the NIC's list of VXLAN and GENEVE UDP ports. Also reset the port list to empty on driver load and on driver unload, with appropriate flag set on the unload case. These port numbers are used for RX inner checksum offload, and in future will also be used for TX inner checksum offload and encapsulated TSO. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-12-03sfc: remove EFX_BUG_ON_PARANOID, use EFX_WARN_ON_[ONCE_]PARANOID insteadEdward Cree1-2/+2
Logically, EFX_BUG_ON_PARANOID can never be correct. For, BUG_ON should only be used if it is not possible to continue without potential harm; and since the non-DEBUG driver will continue regardless (as the BUG_ON is compiled out), clearly the BUG_ON cannot be needed in the DEBUG driver. So, replace every EFX_BUG_ON_PARANOID with either an EFX_WARN_ON_PARANOID or the newly defined EFX_WARN_ON_ONCE_PARANOID. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-23sfc: Handle MCDI proxy authorisationBert Kenward1-0/+9
For unprivileged functions operations can be authorised by an admin function. Extra steps are introduced to the MCDI protocol in this situation - the initial response from the MCDI tells us that the operation has been deferred, and we must retry when told. We then receive an event telling us to retry. Note that this provides only the functionality for the unprivileged functions, not the handling of the administrative side. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-23sfc: Retry MCDI after NO_EVB_PORT error on a VFBert Kenward1-0/+1
After reboot the vswitch configuration from the PF may not be complete before the VF attempts to restore filters. In that case we see NO_EVB_PORT errors from the MC. Retry up to a time limit or until a different result is seen. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: add output flag decoding to efx_mcdi_set_workaroundDaniel Pieczko1-1/+2
The initial use of this will be to check a flag reporting if an FLR was performed on other functions when enabling cascaded multicast filters. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-27sfc: add sysfs entry to control MCDI tracingEdward Cree1-0/+2
MCDI tracing is enabled per-function with a sysfs file /sys/class/net/<NET_DEV>/device/mcdi_logging Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-27sfc: add tracing of MCDI commandsEdward Cree1-0/+4
MCDI tracing is conditional on CONFIG_SFC_MCDI_LOGGING, which is enabled by default. Each MCDI command will produce a console line like sfc dom:bus:dev:fn ifname: MCDI RPC REQ: xxxxxxxx [yyyyyyyy...] where xxxxxxxx etc. are the raw MCDI payload in 32-bit hex chunks. The response will then produce a similar line with "RESP" instead of "REQ", and containing the MCDI response payload (if any). Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-21sfc: Initialise MCDI buffers to 0 on declaration.Jon Cooper1-3/+5
In order to avoid MC bugs the flags field needs to be set to 0. Instead of explicitly clearing out the flags individually, a better way to do this is to memset the MCDI_BUF to 0. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-09sfc: Cope with permissions enforcement added to firmware for SR-IOVEdward Cree1-0/+2
* Accept EPERM in some simple cases, the following cases are handled: 1) efx_mcdi_read_assertion() Unprivileged PCI functions aren't allowed to GET_ASSERTS. We return success as it's up to the primary PF to deal with asserts. 2) efx_mcdi_mon_probe() in efx_ef10_probe() Unprivileged PCI functions aren't allowed to read sensor info, and worrying about sensor data is the primary PF's job. 3) phy_op->reconfigure() in efx_init_port() and efx_reset_up() Unprivileged functions aren't allowed to MC_CMD_SET_LINK, they just have to accept the settings (including flow-control, which is what efx_init_port() is worried about) they've been given. 4) Fallback to GET_WORKAROUNDS in efx_ef10_probe() Unprivileged PCI functions aren't allowed to set workarounds. So if efx_mcdi_set_workaround() fails EPERM, use efx_mcdi_get_workarounds() to find out if workaround_35388 is enabled. 5) If DRV_ATTACH gets EPERM, try without specifying fw-variant Unprivileged PCI functions have to use a FIRMWARE_ID of 0xffffffff (MC_CMD_FW_DONT_CARE). 6) Don't try to exit_assertion unless one had fired Previously we called efx_mcdi_exit_assertion even if efx_mcdi_read_assertion had received MC_CMD_GET_ASSERTS_FLAGS_NO_FAILS. This is unnecessary, and the resulting MC_CMD_REBOOT, even if the AFTER_ASSERTION flag made it a no-op, would fail EPERM for unprivileged PCI functions. So make efx_mcdi_read_assertion return whether an assert happened, and only call efx_mcdi_exit_assertion if it has. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-04-16sfc:On MCDI timeout, issue an FLR (and mark MCDI to fail-fast)Edward Cree1-0/+13
When an MCDI command times out (whether or not we find it completed when we poll), call efx_mcdi_abandon(), which tells all subsequent MCDI calls to fail-fast, and queues up an FLR. Because an FLR doesn't lead to receiving any reboot even from the MC (unlike most other types of reset), we have to call efx_ef10_reset_mc_allocations. In efx_start_all(), if a reset (of any kind) is pending, we bail out. Without this, attempts to reconfigure (e.g. change mtu) can cause driver/mc state inconsistency if the first MCDI call triggers an FLR. For similar reasons, on EF10, in efx_reset_down(method=RESET_TYPE_MCDI_TIMEOUT), set the number of active queues to zero before calling efx_stop_all(). And, on farch, in efx_reset_up(method=RESET_TYPE_MCDI_TIMEOUT), set active_queues and flushes pending & outstanding to zero. efx_mcdi_mode_{poll,event}() should not take us out of fail-fast mode. Instead, this is done by efx_mcdi_reset() after the FLR completes. The new FLR reset_type RESET_TYPE_MCDI_TIMEOUT doesn't really fit into the hierarchy of reset 'scopes' whereby efx_reset() decides some resets subsume others. Thus, it uses separate logic. Also, fixed up some inconsistency around RESET_TYPE_MC_BIST, which was in the wrong place in that hierarchy. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-12-12sfc: Store flags from MC_CMD_DRV_ATTACH for later useBen Hutchings1-0/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Log all unexpected MCDI errorsEdward Cree1-0/+18
Split each of efx_mcdi_rpc, efx_mcdi_rpc_finish, and efx_mcdi_rpc_async into a normal and a _quiet version; made the former log MCDI errors with netif_err (and include the raw MCDI error code), and the latter never log them at all. Changed various callers; any where some errors are expected (but others are not) call the _quiet version and then if necessary log the MCDI error themselves. Said logging is done by new efx_mcdi_display_error. Callers of efx_mcdi_rpc*_quiet functions which may want to log the error need to ensure that their outbuf is big enough to hold an MCDI error; to this end, they now use MCDI_DECLARE_BUF_OUT_OR_ERR, which always allocates at least 8 bytes. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-12-12sfc: Correct RX dropped count for drops while interface is downJon Cooper1-0/+1
We don't directly control RX ingress on Siena or any later controllers, and so we cannot prevent packets from entering the RX datapath while the RX queues are not set up. This results in the hardware incrementing RX_NODESC_DROP_CNT, but it's not an error and we should not include it in error stats. When bringing an interface up or down, pull (or wait for) stats and count the number of packets that were dropped while the interface was down. Subtract this from the reported RX dropped count. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-11-29sfc: Convert to use hwmon_device_register_with_groupsGuenter Roeck1-0/+2
Simplify the code. Avoid race conditions caused by attributes being created after hwmon device registration. Implicitly (through hwmon API) add mandatory 'name' sysfs attribute. Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-09-24sfc: Remove extern from function prototypesJoe Perches1-62/+58
There are a mix of function prototypes with and without extern in the kernel sources. Standardize on not using extern for function prototypes. Function prototypes don't need to be written with extern. extern is assumed by the compiler. Its use is as unnecessary as using auto to declare automatic/local variables in a block. Signed-off-by: Joe Perches <joe@perches.com>
2013-08-29sfc: Update copyright bannersBen Hutchings1-2/+2
Update the dates for files that have been added to in 2012-2013. Drop the 'Solarstorm' brand name that's still lingering here. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29sfc: Add support for Solarflare SFC9100 familyBen Hutchings1-1/+7
This adds support for the EF10 network controller architecture and the SFC9100 family, starting with SFC9120 'Farmingdale', and bumps the driver version to 4.0. New features in the SFC9100 family include: - Flexible allocation of internal resources to PCIe physical and virtual functions under firmware control - RX event merging to reduce DMA writes at high packet rates - Integrated RX timestamping - PIO buffers for lower TX latency - Firmware-driven data path that supports additional offload features and filter types - Delivery of packets between functions and to multiple recipients, allowing firmware to implement a vswitch - Multiple RX flow hash (RSS) contexts with their own hash keys and indirection tables - 40G MAC (single port only) ...not all of which are enabled in this initial driver or the initial firmware release. Much of the new code is by Jon Cooper. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29sfc: Make efx_mcdi_{init,fini}() call efx_mcdi_drv_attach()Ben Hutchings1-2/+0
This should be done during MCDI initialisation for any NIC. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29sfc: Implement asynchronous MCDI requestsBen Hutchings1-4/+25
This will allow use of MCDI from the data path, in particular for accelerated RFS. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-29sfc: Remove unnecessary use of atomic_tBen Hutchings1-1/+1
We can set, get and compare-and-exchange without using atomic_t. Change efx_mcdi_iface::state to the enum type we really wanted it to be. Suggested-by: David Miller <davem@davemloft.net> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-27sfc: use MCDI epoch flag to improve MC reboot detection in the driverDaniel Pieczko1-0/+2
The Huntington MC will reject all MCDI requests after an MC reboot until it sees one with the NOT_EPOCH flag clear. This flag is set by default for all requests, and then cleared on the first request after we detect that an MC reboot has occurred. The old MCDI_STATUS_DELAY_COUNT gave a timeout of 10ms, which was not long enough for the driver to detect that a reboot had occurred based on the warm boot count while calling efx_mcdi_poll_reboot() from the loop in efx_mcdi_ev_death(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-27sfc: Move MTD operations into efx_nic_typeBen Hutchings1-12/+20
Merge the per-NIC-type MTD probe selection and struct efx_mtd_ops into struct efx_nic_type. Move the implementations into the appropriate source files. Several NVRAM functions are now only called from MTD operations which are now implemented in the same file (falcon.c or mcdi.c). There is no need for them to be extern, or to be defined at all if CONFIG_SFC_MTD is not enabled, so move them into the #ifdef CONFIG_SFC_MTD sections in those files. Most of the SPI-related definitions are also only used in falcon.c, so move them there. Put the remainder of spi.h into nic.h (which previously included it). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-22sfc: Define and use MCDI_POPULATE_DWORD_{1,2,3,4,5,6,7}Ben Hutchings1-0/+54
There is only one user now, but we're about to add many more. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Update and improve kernel-doc for efx_mcdi_state & efx_mcdi_ifaceBen Hutchings1-11/+9
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Add support for MCDI v2Ben Hutchings1-4/+6
MCDI v2 adds a second header dword with wider command and length fields. It also defines extra error codes. Change the fallback error number for unknown MCDI error codes from EIO to EPROTO. EIO is treated as indicating the MCDI transport has failed and we need to reset the function, which is rather drastic. v2 error codes and lengths don't fit into completion events, so for a v2-capable transport, always read the response header rather then using the event fields. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Translate MCDI error numbers received in eventsBen Hutchings1-2/+2
Currently we only translate error codes in efx_mcdi_poll(), but we also need to do so in efx_mcdi_ev_cpl(). The reason we didn't notice before is that the MC firmware error codes are mostly taken from Unix/Linux and no translation is necessary on most architectures. Make sure we notice any future failure by changing the sign of resprc (matching the kernel convention) and BUG if it's ever positive at command completion. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Make MCDI independent of SienaBen Hutchings1-0/+21
Move the lowest layer (transport) of the current MCDI code to per-NIC-type operations. Introduce a new structure and efx_nic member for MCDI-specific data. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Make efx_mcdi_init() call efx_mcdi_handle_assertion()Ben Hutchings1-1/+1
This should probably be done during MCDI initialisation for any NIC. Change efx_mcdi_init() to return an error code. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Collect all MCDI port functions into mcdi_port.cBen Hutchings1-2/+7
Collect together MCDI port functions from mcdi.c, mcdi_mac.c, mcdi_phy.c and siena.c. Rename the 'siena' functions accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Move efx_mcdi_mac_reconfigure() to siena.c and renameBen Hutchings1-1/+0
EF10 does not include a multicast hash filter, so this function is specific to Siena. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Move siena_reset_hw() and siena_map_reset_reason() into MCDI moduleBen Hutchings1-2/+2
These implementations should work for EF10 too. Rename them accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Add and use MCDI_SET_QWORD() and MCDI_SET_ARRAY_QWORD()Ben Hutchings1-3/+20
No need to keep open-coding the assignment of high and low dwords. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Ensure MCDI buffers, but not lengths, are dword alignedBen Hutchings1-13/+23
We currently require that MCDI request and response lengths are multiples of 4 bytes, because we will copy dwords in and out of shared memory and we want to be sure we won't read or write out of bounds. But all we really need to know is that there is sufficient padding for that. Also, we should ensure that buffers are dword-aligned, as on some architectures misaligned access will result in data corruption or a crash. Change the buffer type to array-of-efx_dword_t and remove the requirement that the lengths are multiples of 4. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Use proper macros to declare and access MCDI arraysBen Hutchings1-3/+0
A few functions are using heap buffers; change them to use stack buffers as we really don't need to resort to the heap for a 252 byte buffer in process context. MC_CMD_MEMCPY is quite weird in that it can use inline data placed in the request buffer after the array of records. Thus there are two variable-length arrays and we can't use the normal accessors for the second. So we have to use _MCDI_PTR() in efx_sriov_memcpy(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Fill out the set of MCDI accessorsBen Hutchings1-10/+32
We need to access arrays of 16-bit words and 32-bit dwords in MCDI buffers based on the MCDI protocol definitions. We should also be able to read and write fields within structures, without specifying an array index each time. So add MCDI_FIELD() and make MCDI_ARRAY_FIELD() use it. Also add MCDI_SET_FIELD(). Split MCDI_ARRAY_PTR() into MCDI_ARRAY_STRUCT_PTR() and _MCDI_ARRAY_PTR(), which are currently identical but will diverge in later changes. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Rationalise MCDI buffer accessorsBen Hutchings1-26/+20
Add _MCDI_DWORD() which yields an lvalue for the given dword field and change MCDI_DWORD(), MCDI_SET_DWORD() and MCDI_QWORD() to use it. Fold the rather trivial MCDI_PTR2() into MCDI_PTR() and _MCDI_DWORD(). Remove MCDI_SET_DWORD2() and MCDI_QWORD2(). MCDI_DWORD2() should also go, but it still has one user which we'll get rid of later. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2013-08-21sfc: Introduce and use MCDI_DECLARE_BUF macroBen Hutchings1-0/+3
MCDI_DECLARE_BUF declares a variable as an MCDI buffer of the requested length, adding any necessary padding. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-10-02sfc: Fix MCDI structure field lookupBen Hutchings1-2/+4
The least significant bit number (LBN) of a field within an MCDI structure is counted from the start of the structure, not the containing dword. In MCDI_ARRAY_FIELD() we need to mask it rather than using the usual EFX_DWORD_FIELD() macro. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-09-07sfc: Allow efx_mcdi_rpc to be called in two partsStuart Hodgson1-0/+6
For NIC/System time synchonisation efx_mcdi_rpc needs to be split in efx_mcdi_rpc_start and efx_mcdi_rpc_finish operations. Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-16sfc: Add SR-IOV back-end support for SFC9000 familyBen Hutchings1-0/+2
On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF. We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers. There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC. The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF. This is almost entirely the work of Steve Hodgson, formerly shodgson@solarflare.com. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Add hwmon driver for boards using SFC9000-family controllersBen Hutchings1-0/+28
The SFC9000-family controllers have firmware to manage all board peripherals including temperature, heat sink continuity and voltage sensors. The firmware reports sensor alarms, which we log, and will shut down the board if necessary. Some users may want to monitor their boards more closely, so add an hwmon driver that exposes all sensors reported by the firmware. Move efx_mcdi_sensor_event() into the new file so it can share the array of sensor labels with the hwmon driver. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Support extraction of CAPABILITIES from GET_BOARD_CFG response.Matthew Slattery1-1/+1
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Merge efx_mac_operations into efx_nic_typeBen Hutchings1-0/+4
No NICs need to switch efx_mac_operations at run-time, and the MAC operations are fairly closely bound to NIC types. Move efx_mac_operations::reconfigure to efx_nic_type::reconfigure_mac and efx_mac_operations::check_fault fo efx_nic_type::check_mac_fault. Change callers to call through efx->type or directly if the NIC type is known. Remove efx_mac_operations::update_stats. The implementations for Falcon used to fetch MAC statistics synchronously and this was used by efx_register_netdev() to clear statistics after running self-tests. However, it now only converts statistics that have already been fetched (and that only for Falcon), and the call from efx_register_netdev() has no effect. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2011-08-11sfc: Move the Solarflare driversJeff Kirsher1-0/+130
Moves the Solarflare drivers into drivers/net/ethernet/sfc/ and make the necessary Kconfig and Makefile changes. CC: Steve Hodgson <shodgson@solarflare.com> CC: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>