Skip to content

Commit 11b8ad3

Browse files
committed
Merge branch 'dpaa_eth-next'
Madalin Bucur says: ==================== dpaa_eth: Add the QorIQ DPAA Ethernet driver This patch series adds the Ethernet driver for the Freescale QorIQ Data Path Acceleration Architecture (DPAA). This version includes changes following the feedback received on previous versions from Eric Dumazet, Bob Cochran, Joe Perches, Paul Bolle, Joakim Tjernlund, Scott Wood, David Miller - thank you. Together with the driver a managed version of alloc_percpu is provided that simplifies the release of per-CPU memory. The Freescale DPAA architecture consists in a series of hardware blocks that support the Ethernet connectivity. The Ethernet driver depends upon the following drivers that are currently in the Linux kernel: - Peripheral Access Memory Unit (PAMU) drivers/iommu/fsl_* - Frame Manager (FMan) added in v4.4 drivers/net/ethernet/freescale/fman - Queue Manager (QMan), Buffer Manager (BMan) added in v4.9-rc1 drivers/soc/fsl/qbman dpaa_eth interfaces mapping to FMan MACs: dpaa_eth /eth0\ ... /ethN\ driver | | | | ------------- ---- ----------- ---- ------------- -Ports / Tx Rx \ ... / Tx Rx \ FMan | | | | -MACs | MAC0 | | MACN | / dtsec0 \ ... / dtsecN \ (or tgec) / \ / \(or memac) --------- -------------- --- -------------- --------- FMan, FMan Port, FMan SP, FMan MURAM drivers --------------------------------------------------------- FMan HW blocks: MURAM, MACs, Ports, SP --------------------------------------------------------- dpaa_eth relation to QMan, FMan: ________________________________ dpaa_eth / eth0 \ driver / \ --------- -^- -^- -^- --- --------- QMan driver / \ / \ / \ \ / | BMan | |Rx | |Rx | |Tx | |Tx | | driver | --------- |Dfl| |Err| |Cnf| |FQs| | | QMan HW |FQ | |FQ | |FQ | | | | | / \ / \ / \ \ / | | --------- --- --- --- -v- --------- | FMan QMI | | | FMan HW FMan BMI | BMan HW | ----------------------- -------- where the acronyms used above (and in the code) are: DPAA = Data Path Acceleration Architecture FMan = DPAA Frame Manager QMan = DPAA Queue Manager BMan = DPAA Buffers Manager QMI = QMan interface in FMan BMI = BMan interface in FMan FMan SP = FMan Storage Profiles MURAM = Multi-user RAM in FMan FQ = QMan Frame Queue Rx Dfl FQ = default reception FQ Rx Err FQ = Rx error frames FQ Tx Cnf FQ = Tx confirmation FQ Tx FQs = transmission frame queues dtsec = datapath three speed Ethernet controller (10/100/1000 Mbps) tgec = ten gigabit Ethernet controller (10 Gbps) memac = multirate Ethernet MAC (10/100/1000/10000) Changes from v7: - remove the debug option to use a common buffer pool for all the interfaces Changed from v6: - fixed an issue on an error path in dpaa_set_mac_address() - removed NDO operation definitions that were not needed - sorted the local variable declarations - cleaned up a few checkpatch checks - removed friendly network interface naming code Changes from v5: - adapt to the latest Q/BMan drivers API - use build_skb() on Rx path instead of buffer pool refill path - proper support for multiple buffer pools - align function, variable names, code cleanup - driver file structure cleanup Changes from v4: - addressed feedback from Scott Wood and Joe Perches - fixed spelling - fixed leak of uninitialized stack to userspace - fix prints - replace raw_cpu_ptr() with this_cpu_ptr() - remove _s from the end of structure names - remove underscores at start of functions, goto labels - remove likely in error paths - use container_of() instead of open casts - remove priv from the driver name - move return type on same line with function name - drop DPA_READ_SKB_PTR/DPA_WRITE_SKB_PTR Changes from v3: - removed bogus delay and comment in .ndo_stop implementation - addressed minor issues reported by David Miller Changes from v2: - removed debugfs, moved exports to ethtool statistics - removed congestion groups Kconfig params Changes from v1: - bpool level Kconfig options removed - print format using pr_fmt, cleaned up prints - __hot/__cold removed - gratuitous unlikely() removed - code style aligned, consistent spacing for declarations - comment formatting ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 319b053 + e0bd03d commit 11b8ad3

File tree

13 files changed

+3778
-0
lines changed

13 files changed

+3778
-0
lines changed

Documentation/driver-model/devres.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ MEM
332332
MFD
333333
devm_mfd_add_devices()
334334

335+
PER-CPU MEM
336+
devm_alloc_percpu()
337+
devm_free_percpu()
338+
335339
PCI
336340
pcim_enable_device() : after success, all PCI ops become managed
337341
pcim_pin_device() : keep PCI device enabled after release

arch/powerpc/configs/dpaa.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
CONFIG_FSL_DPAA=y
2+
CONFIG_FSL_PAMU=y
3+
CONFIG_FSL_FMAN=y
4+
CONFIG_FSL_DPAA_ETH=y

drivers/base/devres.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/device.h>
1111
#include <linux/module.h>
1212
#include <linux/slab.h>
13+
#include <linux/percpu.h>
1314

1415
#include "base.h"
1516

@@ -985,3 +986,68 @@ void devm_free_pages(struct device *dev, unsigned long addr)
985986
&devres));
986987
}
987988
EXPORT_SYMBOL_GPL(devm_free_pages);
989+
990+
static void devm_percpu_release(struct device *dev, void *pdata)
991+
{
992+
void __percpu *p;
993+
994+
p = *(void __percpu **)pdata;
995+
free_percpu(p);
996+
}
997+
998+
static int devm_percpu_match(struct device *dev, void *data, void *p)
999+
{
1000+
struct devres *devr = container_of(data, struct devres, data);
1001+
1002+
return *(void **)devr->data == p;
1003+
}
1004+
1005+
/**
1006+
* __devm_alloc_percpu - Resource-managed alloc_percpu
1007+
* @dev: Device to allocate per-cpu memory for
1008+
* @size: Size of per-cpu memory to allocate
1009+
* @align: Alignment of per-cpu memory to allocate
1010+
*
1011+
* Managed alloc_percpu. Per-cpu memory allocated with this function is
1012+
* automatically freed on driver detach.
1013+
*
1014+
* RETURNS:
1015+
* Pointer to allocated memory on success, NULL on failure.
1016+
*/
1017+
void __percpu *__devm_alloc_percpu(struct device *dev, size_t size,
1018+
size_t align)
1019+
{
1020+
void *p;
1021+
void __percpu *pcpu;
1022+
1023+
pcpu = __alloc_percpu(size, align);
1024+
if (!pcpu)
1025+
return NULL;
1026+
1027+
p = devres_alloc(devm_percpu_release, sizeof(void *), GFP_KERNEL);
1028+
if (!p) {
1029+
free_percpu(pcpu);
1030+
return NULL;
1031+
}
1032+
1033+
*(void __percpu **)p = pcpu;
1034+
1035+
devres_add(dev, p);
1036+
1037+
return pcpu;
1038+
}
1039+
EXPORT_SYMBOL_GPL(__devm_alloc_percpu);
1040+
1041+
/**
1042+
* devm_free_percpu - Resource-managed free_percpu
1043+
* @dev: Device this memory belongs to
1044+
* @pdata: Per-cpu memory to free
1045+
*
1046+
* Free memory allocated with devm_alloc_percpu().
1047+
*/
1048+
void devm_free_percpu(struct device *dev, void __percpu *pdata)
1049+
{
1050+
WARN_ON(devres_destroy(dev, devm_percpu_release, devm_percpu_match,
1051+
(void *)pdata));
1052+
}
1053+
EXPORT_SYMBOL_GPL(devm_free_percpu);

drivers/net/ethernet/freescale/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ config GIANFAR
9393
and MPC86xx family of chips, the eTSEC on LS1021A and the FEC
9494
on the 8540.
9595

96+
source "drivers/net/ethernet/freescale/dpaa/Kconfig"
97+
9698
endif # NET_VENDOR_FREESCALE

drivers/net/ethernet/freescale/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
2222
ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o
2323

2424
obj-$(CONFIG_FSL_FMAN) += fman/
25+
obj-$(CONFIG_FSL_DPAA_ETH) += dpaa/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
menuconfig FSL_DPAA_ETH
2+
tristate "DPAA Ethernet"
3+
depends on FSL_SOC && FSL_DPAA && FSL_FMAN
4+
select PHYLIB
5+
select FSL_FMAN_MAC
6+
---help---
7+
Data Path Acceleration Architecture Ethernet driver,
8+
supporting the Freescale QorIQ chips.
9+
Depends on Freescale Buffer Manager and Queue Manager
10+
driver and Frame Manager Driver.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Makefile for the Freescale DPAA Ethernet controllers
3+
#
4+
5+
# Include FMan headers
6+
FMAN = $(srctree)/drivers/net/ethernet/freescale/fman
7+
ccflags-y += -I$(FMAN)
8+
9+
obj-$(CONFIG_FSL_DPAA_ETH) += fsl_dpa.o
10+
11+
fsl_dpa-objs += dpaa_eth.o dpaa_ethtool.o dpaa_eth_sysfs.o
12+
CFLAGS_dpaa_eth.o := -I$(src)

0 commit comments

Comments
 (0)