summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl-dpaa2
AgeCommit message (Collapse)AuthorFilesLines
2017-12-08staging: fsl-dpaa2/eth: Make Tx buffer alignment optionalIoana Radulescu2-5/+11
Aligning the Tx buffers at 64B is a performance optimization recommendation, not a hard requirement. Make optional the alignment of Tx FD buffers, without enforcing a reallocation in case there is not enough headroom for it. On Rx, we keep allocating buffers with enough headroom to allow Tx alignment of forwarded frames. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08staging: fsl-dpaa2/eth: Compute needed headroom per frameIoana Radulescu2-6/+14
For non-linear skbs we build scatter-gather frames and allocate a new buffer for the S/G table in which we reserve the required headroom, so the actual skb headroom size doesn't matter. Rather than use a one-size-fits-all approach, decide when to enforce headroom requirements on a frame by frame basis. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08staging: fsl-dpaa2/eth: Don't enable FAS on TxIoana Radulescu2-66/+13
For Tx confirmed frames that have an error indication in the frame descriptor, we look at the Frame Annotation Status field (in the buffer headroom) for details on the root cause and then print a debug message with that information. While useful in initial development stages, it doesn't bring enough added value to justify reserving 64B of headroom for all Tx frames (FAS is only 8B long, but we must reserve chunks of 64B from the hardware annotation area). If we remove the need for FAS field from egress frames, we can renounce hardware annotation completely, since FAS is the only HWA field we currently use. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08staging: fsl-dpaa2/eth: Add counter for skb reallocsIoana Radulescu3-0/+3
Add a counter for the number of egress frames that need to be realloc'ed due to insufficient headroom space. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08staging: fsl-dpaa2/eth: Don't set netdev->needed_headroomIoana Radulescu2-23/+3
Commit 4b2d9fe87950 ("staging: fsl-dpaa2/eth: Extra headroom in RX buffers") tried to avoid the performance penalty of doing skb reallocations in the network stack for IP forwarded frames between two DPAA2 Ethernet interfaces. This led to a (too) complicated formula that relies on the stack's internal implementation. Instead, it's safer and easier to just not request any guarantee from the stack. We already double check in the driver the required headroom size of egress frames and realloc the skb if needed, so we don't need to add any extra code. On forwarding between two of our own interfaces, there is no functional change; for traffic forwarded from a different device or generated on the core, skb realloc operations are moved from the stack to our driver, with no visible impact on performance. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-08staging: fsl-dpaa2/eth: Fix access to FAS fieldIoana Radulescu2-8/+13
Commit 4b2d9fe87950 ("staging: fsl-dpaa2/eth: Extra headroom in RX buffers") removes the software annotation (SWA) area from the RX buffer layout, as it's not used by anyone, but fails to update the macros for accessing hardware annotation (HWA) fields, which is right after the SWA in the buffer headroom. This may lead to some frame annotation status fields (e.g. indication if L3/L4 checksum is valid) to be read incorrectly. Turn the accessor macros into inline functions and add a bool param to specify if SWA is present or not. Fixes: 4b2d9fe87950 ("staging: fsl-dpaa2/eth: Extra headroom in RX buffers") Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-03staging: fsl-dpaa2/eth: Extra headroom in RX buffersBogdan Purcareata2-48/+76
The needed headroom that we ask the stack to reserve for us in TX skbs is larger than the headroom available in RX frames, which leads to skb reallocations in forwarding scenarios involving two DPNI interfaces. Configure the hardware to reserve some extra space in the RX frame headroom to avoid this situation. The value is chosen based on the Tx frame data offset, the Rx buffer alignment value and the netdevice required headroom. The network stack will take care to reserve space for HH_DATA_MOD when building the skb, so there's no need to account for it in the netdevice needed headroom. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-03staging: fsl-dpaa2/eth: Change RX buffer alignmentBogdan Purcareata2-12/+33
The WRIOP hardware block v1.0.0 (found on LS2080A board) requires data in RX buffers to be aligned to 256B, but newer revisions (e.g. on LS2088A, LS1088A) only require 64B alignment. Check WRIOP version and decide at runtime which alignment requirement to configure for ingress buffers. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-03staging: fsl-dpaa2/eth: Don't account SWA in tx_data_offsetBogdan Purcareata1-3/+0
When configuring the Tx buffer layout, the software annotation size is mentioned, and MC accounts for it when configuring the frame tx_data_offset. No need to handle it in the driver as well. This results in 64B less memory allocated per frame. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-03staging: fsl-dpaa2/eth: Split functionIoana Radulescu1-34/+45
Since setup_dpni() became a bit too long, move the buffer layout configuration to a separate function. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-03staging: fsl-dpaa2/eth: Label cleanupIoana Radulescu1-20/+15
Clean up goto labels in a couple of functions, by removing/renaming redundant ones. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Add firmware versionIoana Radulescu4-1/+55
Include firmware version in the driver information exported through ethtool. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Don't use netdev_err too earlyIoana Radulescu1-1/+1
Early during probe the netdevice name is not initialized yet, so use dev_err instead of netdev_err when printing error messages. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Use implicit clear of link interruptIoana Radulescu1-9/+3
dpni_get_irq_status() also looks at the input value of its status parameter, and if not null it automatically clears from pending state the bits that are set there. Use this feature to avoid a separate MC command for clearing the interrupt event bits after reading the status. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Fix double DMA unmapIoana Radulescu1-2/+9
In case we fail to allocate a skb for a fragmented ingress frame, the cleanup function will attempt to unmap again the first frame fragment, which had already been unmapped during early Rx processing. Avoid this by freeing the first buffer immediately in case we hit an error, leaving the cleanup function to free only the subsequent buffers. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Refactor interrupt arming in NAPI pollIoana Radulescu1-2/+1
Take into consideration the return value of napi_complete_done(), since there might be an indication that it's not suitable to enable driver interrupts yet. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Check if notification rearm is successfulIoana Radulescu1-0/+2
In case dpaa2_io_service_rearm() fails with an error other then EBUSY, it will do so silently; add a check for this and a warning message, as a failure here means we're unable to receive any more traffic on the current cpu. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Check SGT final bit is presentIoana Radulescu1-0/+2
For scatter-gather ingress frames, we expect to receive a list of fragments from the hardware, last of which is marked with a "final" bit. Add a check to make sure the Rx frame has this bit set correctly; there's not much we can do in case of a malformed frame, but at least issue a warning. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Account for Rx FD buffers on error pathIoana Radulescu1-4/+11
On Rx path, if we fail to build an skb from the incoming FD, we still need to update the channel buffer count accordingly, otherwise we risk depleting the pool while the software counter still sees available buffers. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18staging: fsl-dpaa2/eth: Fix potential endless loopIoana Radulescu1-23/+35
We incorrectly assumed that dpaa2_io_release() can only return -EBUSY as an error code, when in fact it can also fail in case some of its arguments don't have valid values. Make sure we only retry the operation while the portal is busy and abort for all other error cases, otherwise we risk entering an endless loop. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-09-01staging: fsl-dpaa2/eth: fix off-by-one FD ctrl bitmaksHoria Geantă1-2/+2
Fix the values of DPAA2_FD_CTRL_FSE and DPAA2_FD_CTRL_FAERR, which are shifted off by one bit. Fixes: 39163c0ce0f48 ("staging: fsl-dpaa2/eth: Errors checking update") Cc: <stable@vger.kernel.org> Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-23Staging: fsl-dpaa2: ethernet: dpni.c: Fixed alignment to match open parenthesis.Srishti Sharma1-1/+1
Fixed alignment so that it matched open parenthesis Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30staging: fsl-dpaa2/eth: Error report format fixesBogdan Purcareata1-2/+2
Fix mishaps in error format strings. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30staging: fsl-dpaa2/eth: Fix skb use after freeBogdan Purcareata1-1/+1
Once a Tx frame descriptor is enqueued, an interrupt might be triggered to process the Tx confirmation and free the skb, hitting a memory use after free when updating the tx_bytes statistic based on skb->len. Use the frame descriptor length instead. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-30staging: fsl-mc: allow the driver compile multi-archLaurentiu Tudor1-1/+1
Add an alternate dependency on COMPILE_TEST, thus leaving this driver compile on other architectures. Also, other drivers depending on the bus are updated to depend on ARCH_LAYERSCAPE until they'll also be made multi-arch. This was compiled tested on: - booke powerpc (corenet{32,64}_smp_defconfig) - x86 (i386_defconfig, x86_64_defconfig, needs CONFIG_OF) - arm64 (defconfig) Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-16staging: fsl-dpaa2/eth: Remove dead codeIoana Radulescu1-2/+0
All possible values of the switch statement are explicitly handled, so there's no need to have a default branch. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Acked-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29staging: fsl-mc: move mc-cmd.h contents in the public headerLaurentiu Tudor1-1/+0
mc-cmd.h contains some low level functions used to encode and decode commands to the MC. They are used by the drivers so move them to the public headers and get rid of the mc-cmd.h header. Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29staging: fsl-mc: move mc-sys.h contents in the public headerLaurentiu Tudor2-2/+1
mc-sys.h contains the API to send commands to the MC and is used by drivers. Move it to the public headers and get rid of the mc-sys.h header. Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-26Revert "staging: fsl-mc: move mc-sys.h contents in the public header"Greg Kroah-Hartman2-1/+2
This reverts commit 7d6e221d73904aedcbd46ce2db6a545be55d2296. The whole series is broken, so back it all out. Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-26Revert "staging: fsl-mc: move mc-cmd.h contents in the public header"Greg Kroah-Hartman1-0/+1
This reverts commit 9b1aa45539fb8389deb79e4a939bfc05ee45aeb5. The whole series is broken, so back it all out. Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-23staging: fsl-mc: move mc-cmd.h contents in the public headerLaurentiu Tudor1-1/+0
mc-cmd.h contains some low level functions used to encode and decode commands to the MC. They are used by the drivers so move them to the public headers and get rid of the mc-cmd.h header. Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-23staging: fsl-mc: move mc-sys.h contents in the public headerLaurentiu Tudor2-2/+1
mc-sys.h contains the API to send commands to the MC and is used by drivers. Move it to the public headers and get rid of the mc-sys.h header. Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-23staging: fsl-dpaa2/eth: fix a couple of implicit includesLaurentiu Tudor1-0/+2
dpni.c is using byte order macros and error codes but does not explicitly include the required kernel header, so add it. Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> Acked-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Update number of netdev queuesIoana Radulescu1-0/+14
Currently, the netdevice is allocated with a default number of Rx/Tx queues equal to CONFIG_NR_CPUS, meaning the maximum number of cores supported by the current kernel. The actual number of queues is reflected by the DPNI object attribute, so update the netdevice configuration based on that. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Refactor MAC address setupIoana Radulescu1-17/+29
The driver logic for allocating a MAC address to a net device is complicated enough to deserve a function of its own. While here, cleanup a bit the code comments. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Errors checking updateIoana Radulescu2-10/+43
On the egress path, frame errors are reported using both a FD control field and the frame annotation status. The current code only handles FAS errors. Update to look at both fields when accounting Tx errors. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Only store bpid in priv structIoana Radulescu2-6/+8
We only need to know the buffer pool id, so save exactly that in the device's private structure, instead of the entire DPBP attributes struct. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Remove unused fields from priv structIoana Radulescu2-22/+16
Remove the dpni_id and buffer_layout fields from device's private structure. They're only used at probe so we don't need to store them for further use. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Add accessor for FAS fieldIoana Radulescu2-17/+20
Introduce a helper macro for accessing the frame annotation status field in a frame buffer. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Update ethtool stats namesIoana Radulescu1-27/+27
Add a label to the ethtool statistics counters, to differentiate between hardware counters and driver specific ones. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Defer probing if no DPIOs foundIoana Radulescu1-3/+7
If the Ethernet driver doesn't find any DPIO devices during probe, it may be either because there's none available or because they haven't been probed yet. Request deferred probing in case it's the latter. Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Reset dpbpIoana Radulescu1-0/+7
Reset the buffer pool object before using it, like we do for the other DPAA2 objects. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Always call napi_gro_receive()Ioana Radulescu1-4/+1
The function itself checks whether GRO support is enabled and acts accordingly, so we don't need to verify it in the driver as well. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Don't use GFP_DMAIoana Radulescu1-1/+1
Don't use GFP_DMA when allocating memory for the hash key, as we don't actually need to allocate from the lowest zone. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Minor cleanup in dpaa2_eth_set_hashIoana Radulescu1-3/+3
We already have a variable for the DMA mapping device, so use that directly. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Add error message newlinesIoana Radulescu2-10/+10
A few error/warning messages lacked a newline at the end of the text. Add it for improved consistency and cosmetics. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Remove incorrect error pathIoana Radulescu1-2/+2
Not having Rx hashing distribution enabled for an interface is a valid configuration and shouldn't be treated as an error. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Fix return type of ndo_start_xmitIoana Radulescu1-1/+1
ndo_start_xmit() returns a value of type netdev_tx_t. Update our ndo function to use the correct type. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Initialize variable before useIoana Radulescu1-1/+1
In dpni_get_irq_status(), status is both in and out parameter, so initialize before use. Issue found through static analysis tool. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13staging: fsl-dpaa2/eth: Add "static" keyword where neededIoana Radulescu3-7/+5
Make a couple of locally used functions and structures static. Issue found through static analysis tool. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>