Re: [PATCH RFC 02/11] dpaa_eth: add support for DPAA Ethernet

2015-03-18 Thread Kumar Gala

On Mar 17, 2015, at 1:58 PM, Madalin Bucur madalin.bu...@freescale.com wrote:

 This introduces the Freescale Data Path Acceleration Architecture
 (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
 BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
 the Freescale DPAA QorIQ platforms.
 
 Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
 ---
 drivers/net/ethernet/freescale/Kconfig |2 +
 drivers/net/ethernet/freescale/Makefile|1 +
 drivers/net/ethernet/freescale/dpaa/Kconfig|   49 +
 drivers/net/ethernet/freescale/dpaa/Makefile   |   14 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |  837 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  446 +++
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  | 1288 
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h  |  119 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c  |  428 +++
 9 files changed, 3184 insertions(+)
 create mode 100644 drivers/net/ethernet/freescale/dpaa/Kconfig
 create mode 100644 drivers/net/ethernet/freescale/dpaa/Makefile
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
 
 diff --git a/drivers/net/ethernet/freescale/Kconfig 
 b/drivers/net/ethernet/freescale/Kconfig
 index ba84c4a..dd485f1 100644
 --- a/drivers/net/ethernet/freescale/Kconfig
 +++ b/drivers/net/ethernet/freescale/Kconfig
 @@ -95,4 +95,6 @@ config GIANFAR
 This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
 and MPC86xx family of chips, and the FEC on the 8540.
 
 +source drivers/net/ethernet/freescale/dpaa/Kconfig
 +
 endif # NET_VENDOR_FREESCALE
 diff --git a/drivers/net/ethernet/freescale/Makefile 
 b/drivers/net/ethernet/freescale/Makefile
 index 71debd1..b6c10ab 100644
 --- a/drivers/net/ethernet/freescale/Makefile
 +++ b/drivers/net/ethernet/freescale/Makefile
 @@ -12,6 +12,7 @@ obj-$(CONFIG_FS_ENET) += fs_enet/
 obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
 obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
 +obj-$(if $(CONFIG_FSL_DPAA_ETH),y) += dpaa/

Why isn’t

obj-$(CONFIG_FSL_DPAA_ETH)  += dpaa/ 

enough?

 obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o
 gianfar_driver-objs := gianfar.o \
   gianfar_ethtool.o
 diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig 
 b/drivers/net/ethernet/freescale/dpaa/Kconfig
 new file mode 100644
 index 000..7ef703c
 --- /dev/null
 +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
 @@ -0,0 +1,49 @@
 +menuconfig FSL_DPAA_ETH
 + tristate DPAA Ethernet
 + depends on FSL_SOC  FSL_BMAN  FSL_QMAN  FSL_FMAN
 + select PHYLIB
 + select FSL_FMAN_MAC
 + ---help---
 +   Data Path Acceleration Architecture Ethernet driver,
 +   supporting the Freescale QorIQ chips.
 +   Depends on Freescale Buffer Manager and Queue Manager
 +   driver and Frame Manager Driver.
 +
 +if FSL_DPAA_ETH
 +
 +config FSL_DPAA_CS_THRESHOLD_1G
 + hex Egress congestion threshold on 1G ports
 + depends on FSL_DPAA_ETH
 + range 0x1000 0x1000
 + default 0x0600
 + ---help---
 +   The size in bytes of the egress Congestion State notification 
 threshold on 1G ports.
 +   The 1G dTSECs can quite easily be flooded by cores doing Tx in a 
 tight loop
 +   (e.g. by sending UDP datagrams at while(1) speed),
 +   and the larger the frame size, the more acute the problem.
 +   So we have to find a balance between these factors:
 +- avoiding the device staying congested for a prolonged time 
 (risking
 + the netdev watchdog to fire - see also the tx_timeout 
 module param);
 +   - affecting performance of protocols such as TCP, which 
 otherwise
 +  behave well under the congestion notification mechanism;
 +- preventing the Tx cores from tightly-looping (as if the 
 congestion
 +  threshold was too low to be effective);
 +- running out of memory if the CS threshold is set too high.
 +
 +config FSL_DPAA_CS_THRESHOLD_10G
 + hex Egress congestion threshold on 10G ports
 + depends on FSL_DPAA_ETH
 + range 0x1000 0x2000
 + default 0x1000
 + ---help ---
 +   The size in bytes of the egress Congestion State notification 
 threshold on 10G ports.
 +
 +config FSL_DPAA_INGRESS_CS_THRESHOLD
 + hex Ingress congestion threshold on FMan ports
 + depends on FSL_DPAA_ETH
 + default 0x1000
 + ---help---
 +   The size in bytes of the ingress tail-drop threshold on FMan ports.
 +   Traffic piling up above this value will be rejected by QMan and 
 

RE: RE: [PATCH RFC 02/11] dpaa_eth: add support for DPAA Ethernet

2015-03-18 Thread Madalin-Cristian Bucur
 -Original Message-
 From: Kumar Gala [mailto:ga...@kernel.crashing.org]
 
 On Mar 17, 2015, at 1:58 PM, Madalin Bucur madalin.bu...@freescale.com
 wrote:
 
  This introduces the Freescale Data Path Acceleration Architecture
  (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
  BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
  the Freescale DPAA QorIQ platforms.
 
  Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
  ---

[snip]

  diff --git a/drivers/net/ethernet/freescale/Makefile
 b/drivers/net/ethernet/freescale/Makefile
  index 71debd1..b6c10ab 100644
  --- a/drivers/net/ethernet/freescale/Makefile
  +++ b/drivers/net/ethernet/freescale/Makefile
  @@ -12,6 +12,7 @@ obj-$(CONFIG_FS_ENET) += fs_enet/
  obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
  obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
  obj-$(CONFIG_GIANFAR) += gianfar_driver.o
  +obj-$(if $(CONFIG_FSL_DPAA_ETH),y) += dpaa/
 
 Why isn't
 
 obj-$(CONFIG_FSL_DPAA_ETH)    += dpaa/
 
 enough?

It is, will fix.

  diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig
 b/drivers/net/ethernet/freescale/dpaa/Kconfig
  new file mode 100644
  index 000..7ef703c
  --- /dev/null
  +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
  @@ -0,0 +1,49 @@
  +menuconfig FSL_DPAA_ETH
  +  tristate DPAA Ethernet
  +  depends on FSL_SOC  FSL_BMAN  FSL_QMAN  FSL_FMAN
  +  select PHYLIB
  +  select FSL_FMAN_MAC
  +  ---help---
  +    Data Path Acceleration Architecture Ethernet driver,
  +    supporting the Freescale QorIQ chips.
  +    Depends on Freescale Buffer Manager and Queue Manager
  +    driver and Frame Manager Driver.
  +
  +if FSL_DPAA_ETH
  +
  +config FSL_DPAA_CS_THRESHOLD_1G
  +  hex Egress congestion threshold on 1G ports
  +  depends on FSL_DPAA_ETH
  +  range 0x1000 0x1000
  +  default 0x0600
  +  ---help---
  +    The size in bytes of the egress Congestion State notification
 threshold on 1G ports.
  +    The 1G dTSECs can quite easily be flooded by cores doing Tx in a
 tight loop
  +    (e.g. by sending UDP datagrams at while(1) speed),
  +    and the larger the frame size, the more acute the problem.
  +    So we have to find a balance between these factors:
  +     - avoiding the device staying congested for a prolonged time
 (risking
  + the netdev watchdog to fire - see also the tx_timeout 
  module
 param);
  +   - affecting performance of protocols such as TCP, which 
  otherwise
  +   behave well under the congestion notification mechanism;
  +     - preventing the Tx cores from tightly-looping (as if the
 congestion
  +   threshold was too low to be effective);
  +     - running out of memory if the CS threshold is set too high.
  +
  +config FSL_DPAA_CS_THRESHOLD_10G
  +  hex Egress congestion threshold on 10G ports
  +  depends on FSL_DPAA_ETH
  +  range 0x1000 0x2000
  +  default 0x1000
  +  ---help ---
  +    The size in bytes of the egress Congestion State notification
 threshold on 10G ports.
  +
  +config FSL_DPAA_INGRESS_CS_THRESHOLD
  +  hex Ingress congestion threshold on FMan ports
  +  depends on FSL_DPAA_ETH
  +  default 0x1000
  +  ---help---
  +    The size in bytes of the ingress tail-drop threshold on FMan ports.
  +    Traffic piling up above this value will be rejected by QMan and
 discarded by FMan.
  +
 
 Do these thresholds really need to be kconfig options?  Are they not
 changeable at runtime?

Probably Bogdan thought it was an easy way to provide basic means to tweak them
and also provide some explanation for them. The current setting is chosen to 
keep
them mostly out of the way but still address a corner case a customer reported, 
if
I remember correctly. No runtime change is supported.

  diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile
 b/drivers/net/ethernet/freescale/dpaa/Makefile
  new file mode 100644
  index 000..bdeb04e
  --- /dev/null
  +++ b/drivers/net/ethernet/freescale/dpaa/Makefile
  @@ -0,0 +1,14 @@
  +#
  +# Makefile for the Freescale DPAA Ethernet controllers
  +#
  +ccflags-y += -DVERSION=\\
 
 Is this really needed, if so we need to fix that.

Unused, will remove.

[snip]
  +
  +#define DPA_DESCRIPTION FSL DPAA Ethernet driver
  +
  +MODULE_LICENSE(Dual BSD/GPL);
  +
  +MODULE_AUTHOR(Andy Fleming aflem...@freescale.com);
  +
  +MODULE_DESCRIPTION(DPA_DESCRIPTION);
 
 These are typically at the end of the file, and kept together (ie no blank 
 lines
 between them)

Will move them.

[snip]
  +
  +static struct platform_device_id dpa_devtype[] = {
  +  {
  +  .name = dpaa-ethernet,
  +  .driver_data = 0,
  +  }, {
  +  }
  +};
  +MODULE_DEVICE_TABLE(platform, dpa_devtype);
  +
  +static struct platform_driver dpa_driver = {
  +  .driver = {
  + 

[PATCH RFC 02/11] dpaa_eth: add support for DPAA Ethernet

2015-03-17 Thread Madalin Bucur
This introduces the Freescale Data Path Acceleration Architecture
(DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan,
BMan, PAMU and FMan drivers to deliver Ethernet connectivity on
the Freescale DPAA QorIQ platforms.

Signed-off-by: Madalin Bucur madalin.bu...@freescale.com
---
 drivers/net/ethernet/freescale/Kconfig |2 +
 drivers/net/ethernet/freescale/Makefile|1 +
 drivers/net/ethernet/freescale/dpaa/Kconfig|   49 +
 drivers/net/ethernet/freescale/dpaa/Makefile   |   14 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |  837 +
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  446 +++
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.c  | 1288 
 .../net/ethernet/freescale/dpaa/dpaa_eth_common.h  |  119 ++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c  |  428 +++
 9 files changed, 3184 insertions(+)
 create mode 100644 drivers/net/ethernet/freescale/dpaa/Kconfig
 create mode 100644 drivers/net/ethernet/freescale/dpaa/Makefile
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.c
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_common.h
 create mode 100644 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c

diff --git a/drivers/net/ethernet/freescale/Kconfig 
b/drivers/net/ethernet/freescale/Kconfig
index ba84c4a..dd485f1 100644
--- a/drivers/net/ethernet/freescale/Kconfig
+++ b/drivers/net/ethernet/freescale/Kconfig
@@ -95,4 +95,6 @@ config GIANFAR
  This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
  and MPC86xx family of chips, and the FEC on the 8540.
 
+source drivers/net/ethernet/freescale/dpaa/Kconfig
+
 endif # NET_VENDOR_FREESCALE
diff --git a/drivers/net/ethernet/freescale/Makefile 
b/drivers/net/ethernet/freescale/Makefile
index 71debd1..b6c10ab 100644
--- a/drivers/net/ethernet/freescale/Makefile
+++ b/drivers/net/ethernet/freescale/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_FS_ENET) += fs_enet/
 obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
 obj-$(CONFIG_FSL_XGMAC_MDIO) += xgmac_mdio.o
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
+obj-$(if $(CONFIG_FSL_DPAA_ETH),y) += dpaa/
 obj-$(CONFIG_PTP_1588_CLOCK_GIANFAR) += gianfar_ptp.o
 gianfar_driver-objs := gianfar.o \
gianfar_ethtool.o
diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig 
b/drivers/net/ethernet/freescale/dpaa/Kconfig
new file mode 100644
index 000..7ef703c
--- /dev/null
+++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
@@ -0,0 +1,49 @@
+menuconfig FSL_DPAA_ETH
+   tristate DPAA Ethernet
+   depends on FSL_SOC  FSL_BMAN  FSL_QMAN  FSL_FMAN
+   select PHYLIB
+   select FSL_FMAN_MAC
+   ---help---
+ Data Path Acceleration Architecture Ethernet driver,
+ supporting the Freescale QorIQ chips.
+ Depends on Freescale Buffer Manager and Queue Manager
+ driver and Frame Manager Driver.
+
+if FSL_DPAA_ETH
+
+config FSL_DPAA_CS_THRESHOLD_1G
+   hex Egress congestion threshold on 1G ports
+   depends on FSL_DPAA_ETH
+   range 0x1000 0x1000
+   default 0x0600
+   ---help---
+ The size in bytes of the egress Congestion State notification 
threshold on 1G ports.
+ The 1G dTSECs can quite easily be flooded by cores doing Tx in a 
tight loop
+ (e.g. by sending UDP datagrams at while(1) speed),
+ and the larger the frame size, the more acute the problem.
+ So we have to find a balance between these factors:
+  - avoiding the device staying congested for a prolonged time 
(risking
+ the netdev watchdog to fire - see also the tx_timeout module 
param);
+   - affecting performance of protocols such as TCP, which 
otherwise
+behave well under the congestion notification mechanism;
+  - preventing the Tx cores from tightly-looping (as if the 
congestion
+threshold was too low to be effective);
+  - running out of memory if the CS threshold is set too high.
+
+config FSL_DPAA_CS_THRESHOLD_10G
+   hex Egress congestion threshold on 10G ports
+   depends on FSL_DPAA_ETH
+   range 0x1000 0x2000
+   default 0x1000
+   ---help ---
+ The size in bytes of the egress Congestion State notification 
threshold on 10G ports.
+
+config FSL_DPAA_INGRESS_CS_THRESHOLD
+   hex Ingress congestion threshold on FMan ports
+   depends on FSL_DPAA_ETH
+   default 0x1000
+   ---help---
+ The size in bytes of the ingress tail-drop threshold on FMan ports.
+ Traffic piling up above this value will be rejected by QMan and 
discarded by FMan.
+
+endif # FSL_DPAA_ETH
diff --git a/drivers/net/ethernet/freescale/dpaa/Makefile 
b/drivers/net/ethernet/freescale/dpaa/Makefile
new file