summaryrefslogtreecommitdiffstats
path: root/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: fsl-dpaa2/eth: Don't use netdev_err too earlyIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Use implicit clear of link interruptIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Fix double DMA unmapIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Refactor interrupt arming in NAPI pollIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Check if notification rearm is successfulIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Check SGT final bit is presentIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Account for Rx FD buffers on error pathIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Fix potential endless loopIoana Radulescu2017-10-181-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>
* staging: fsl-dpaa2/eth: Error report format fixesBogdan Purcareata2017-07-301-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>
* staging: fsl-dpaa2/eth: Fix skb use after freeBogdan Purcareata2017-07-301-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>
* staging: fsl-mc: move mc-sys.h contents in the public headerLaurentiu Tudor2017-06-291-1/+0
| | | | | | | | | 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>
* Revert "staging: fsl-mc: move mc-sys.h contents in the public header"Greg Kroah-Hartman2017-06-261-0/+1
| | | | | | | | | | 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>
* staging: fsl-mc: move mc-sys.h contents in the public headerLaurentiu Tudor2017-06-231-1/+0
| | | | | | | | | 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>
* staging: fsl-dpaa2/eth: Update number of netdev queuesIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Refactor MAC address setupIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Errors checking updateIoana Radulescu2017-06-131-8/+28
| | | | | | | | | | 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>
* staging: fsl-dpaa2/eth: Only store bpid in priv structIoana Radulescu2017-06-131-5/+7
| | | | | | | | | 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>
* staging: fsl-dpaa2/eth: Remove unused fields from priv structIoana Radulescu2017-06-131-17/+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>
* staging: fsl-dpaa2/eth: Add accessor for FAS fieldIoana Radulescu2017-06-131-17/+14
| | | | | | | | 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>
* staging: fsl-dpaa2/eth: Defer probing if no DPIOs foundIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Reset dpbpIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Always call napi_gro_receive()Ioana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Don't use GFP_DMAIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Minor cleanup in dpaa2_eth_set_hashIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Add error message newlinesIoana Radulescu2017-06-131-7/+7
| | | | | | | | 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>
* staging: fsl-dpaa2/eth: Remove incorrect error pathIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Fix return type of ndo_start_xmitIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Initialize variable before useIoana Radulescu2017-06-131-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>
* staging: fsl-dpaa2/eth: Add "static" keyword where neededIoana Radulescu2017-06-131-3/+3
| | | | | | | | 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>
* staging: fsl-dpaa2/eth: Map Tx buffers as bidirectionalIoana Radulescu2017-05-291-7/+7
| | | | | | | | | | | | | WRIOP hardware may need to write to the hardware annotation area of Tx buffers (e.g. frame status bits) and also to the data area (e.g. L4 checksum in frame header). Map these buffers as DMA_BIDIRECTIONAL, otherwise the write transaction through SMMU will not be allowed. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: fsl-dpaa2/eth: Fix address translationsIoana Radulescu2017-05-291-6/+19
| | | | | | | | | | | Use the correct mechanisms for translating a DMA-mapped IOVA address into a virtual one. Without this fix, once SMMU is enabled on Layerscape platforms, the Ethernet driver throws IOMMU translation faults. Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com> Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: fsl-dpaa2/eth: Add trace pointsIoana Radulescu2017-04-281-0/+21
| | | | | | | | Add trace events in significant places of the data path. Useful for debuggging. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: fsl-dpaa2/eth: Add driver specific statsIoana Radulescu2017-04-281-2/+40
| | | | | | | | | Add custom statistics to be reported via ethtool -S. These include driver specific per-cpu statistics as well as queue and channel counters. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: fsl-dpaa2/eth: Add ethtool supportIoana Radulescu2017-04-281-0/+6
| | | | | | | | | Add support for several ethtool operations: show hardware statistics, get/set link settings, get hash configuration. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driverIoana Radulescu2017-04-281-0/+2455
Introduce the DPAA2 Ethernet driver, which manages Datapath Network Interface (DPNI) objects discovered on the MC bus. In addition to DPNIs, the Ethernet driver uses several other MC objects to build a network interface abstraction: buffer pools (DPBPs), I/O Portals (DPIOs) and concentrators (DPCONs). A more detailed description of the driver can be found in the associated README file. Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> Signed-off-by: Bogdan Hamciuc <bogdan.hamciuc@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud