net: fec: imx6sx multiqueue support
Subsystems (5)
cover net: fec: imx6sx multiqueue support
These patches enable i.MX6SX multi queue support.
i.MX6SX support 3 queue and AVB feature.
Frank Li (3):
net:fec: add enet-avb IP support
ARM: Documentation: Update fec dts binding doc
ARM: dts: imx6sx: add multi-queue support enet
Fugang Duan (8):
net:fec: add enet refrence clock for i.MX 6SX chip net:fec: add enet AVB feature macro define for imx6sx net:fec: use multiqueue interface to allocate Ethernet device net:fec: add multiqueue support
net:fec: Disable enet-avb MAC instead of reset MAC net:fec: Add fsl,imx6sx-fec compatible strings
net:fec: change FEC alignment to 64 bytes for ARM platform net:fec: remove unnessary memory copy for address alignment in .xmit()
Documentation/devicetree/bindings/net/fsl-fec.txt | 6 + arch/arm/boot/dts/imx6sx.dtsi | 2 + drivers/net/ethernet/freescale/fec.h | 151 +++- drivers/net/ethernet/freescale/fec_main.c | 877 +++++++++++++++------- 4 files changed, 750 insertions(+), 286 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/11 net:fec: add enet refrence clock for i.MX 6SX chip
In reply to a message not in the archiveFrom: Fugang Duan <[email protected]>
i.MX6sx enet has below clocks for user config:clk_ipg: ipg_clk_s, ipg_clk_mac0_s, 66Mhzclk_ahb: enet system clock, it is enet AXI clock for imx6sx.
For imx6sx, it alos is the clock source of interrupt coalescing. The clock range: 200Mhz ~ 266Mhz.
clk_ref: refrence clock for tx and rx. For imx6sx enet RGMII mode,
the refrence clock is 125Mhz coming from internal PLL or external. In i.MX6sx-arm2 board, the clock is from internal PLL. clk_ref is optional, depends on board.clk_enet_out: The clock can be output from internal PLL. It can supply 50Mhz
clock for phy. clk_enet_out is optional, depends on chip and board.clk_ptp: 1588 ts clock. It is optional, depends on chip.
The patch add clk_ref to distiguish the different clocks.
--- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
drivers/net/ethernet/freescale/fec.h +1 -0
@@ -272,6 +272,7 @@ struct fec_enet_private {struct clk *clk_ipg;struct clk *clk_ahb; +struct clk *clk_ref;struct clk *clk_enet_out;struct clk *clk_ptp;
drivers/net/ethernet/freescale/fec_main.c +17 -0
@@ -1621,6 +1621,11 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) }mutex_unlock (&fep->ptp_clk_mutex); } +if (fep->clk_ref) { + ret =clk_prepare_enable (fep->clk_ref); +if (ret) + goto failed_clk_ref; + } }else {clk_disable_unprepare (fep->clk_ahb);clk_disable_unprepare (fep->clk_ipg);
@@ -1632,9 +1637,15 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) fep->ptp_clk_on = false;mutex_unlock (&fep->ptp_clk_mutex); } +if (fep->clk_ref) +clk_disable_unprepare (fep->clk_ref); }return 0 ; + +failed_clk_ref: +if (fep->clk_ref) +clk_disable_unprepare (fep->clk_ref); failed_clk_ptp:if (fep->clk_enet_out)clk_disable_unprepare (fep->clk_enet_out);
@@ -2637,6 +2648,12 @@ fec_probe(struct platform_device *pdev) fep->ptp_clk_on = false;mutex_init (&fep->ptp_clk_mutex); + +/* clk_ref is optional, depends on board */ + fep->clk_ref =devm_clk_get (&pdev->dev,"enet_clk_ref" ); +if (IS_ERR (fep->clk_ref)) + fep->clk_ref =NULL ; + fep->clk_ptp =devm_clk_get (&pdev->dev,"ptp" ); fep->bufdesc_ex = pdev->id_entry->driver_data &FEC_QUIRK_HAS_BUFDESC_EX ;
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/11 net:fec: add enet AVB feature macro define for imx6sx
In reply to a message not in the archiveFrom: Fugang Duan <[email protected]>
Add enet AVB feature macro define for imx6sx.
--- drivers/net/ethernet/freescale/fec_main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +16 -0
@@ -104,6 +104,16 @@ static void set_multicast_list(struct net_device *ndev);* ENET_TDAR[TDAR]. */ #define FEC_QUIRK_ERR006358 (1 << 7) +/* ENET IP hw AVB +* +* i.MX6SX ENET IP add Audio Video Bridging (AVB) feature support. +* - Two class indicators on receive with configurable priority +* - Two class indicators and line speed timer on transmit allowing +* implementation class credit based shapers externally +* - Additional DMA registers provisioned to allow managing up to 3 +* independent rings +*/ +#define FEC_QUIRK_HAS_AVB (1 << 8)static struct platform_device_id fec_devtype[] = { {
@@ -128,6 +138,12 @@ static struct platform_device_id fec_devtype[] = { .name = "mvf600-fec", .driver_data = FEC_QUIRK_ENET_MAC, }, { + .name = "imx6sx-fec", + .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | + FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | + FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | + FEC_QUIRK_HAS_AVB, + }, {/* sentinel */ } };
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/11 net:fec: use multiqueue interface to allocate Ethernet device
In reply to Frank LiFrom: Fugang Duan <[email protected]>
Since i.MX6SX enet-AVB IP support multi queues, so use multi queues interface to allocate and set up an Ethernet device.
--- drivers/net/ethernet/freescale/fec.h | 9 ++++++ drivers/net/ethernet/freescale/fec_main.c | 49 ++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec.h +9 -0
@@ -233,6 +233,13 @@ struct bufdesc_ex {/* This device has up to three irqs on some platforms */ #define FEC_IRQ_NUM 3 +/* Maximum number of queues supported +* ENET with AVB IP can support up to 3 independent tx queues and rx queues. +* User can point the queue number that is less than or equal to 3. +*/ +#define FEC_ENET_MAX_TX_QS 3 +#define FEC_ENET_MAX_RX_QS 3 +/* The number of Tx and Rx buffers. These are allocated from the page * pool. The code may assume these are power of two, so it it best * to keep them that size.
@@ -278,6 +285,8 @@ struct fec_enet_private {bool ptp_clk_on;struct mutex ptp_clk_mutex; +int num_tx_queues; +int num_rx_queues;/* The saved address of a sent-in-place packet/buffer, for skfree(). */ unsigned char *tx_bounce[TX_RING_SIZE ];
drivers/net/ethernet/freescale/fec_main.c +48 -1
73 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 4/11 net:fec: add multiqueue support
In reply to a message not in the archiveFrom: Fugang Duan <[email protected]>
Add multiqueue support, which is compatible with previous single queue driver for FEC/ENET IPs.
By default, the tx/rx queue number is 1, user can config the queue number at DTS file like this:
fsl,num_tx_queues=<3>; fsl,num_rx_queues=<3>;
Ethernet multiqueue mechanism can improve performance in SMP system. For single hw queue, multiqueue can balance cpu loading.
For multi hw queues, multiple cores can process network packets in parallel, and refer the article for the detail advantage for multiqueue:
http://vger.kernel.org/~davem/davem_nyc09.pdf
--- drivers/net/ethernet/freescale/fec.h | 108 ++++- drivers/net/ethernet/freescale/fec_main.c | 730 ++++++++++++++++++++---------- 2 files changed, 577 insertions(+), 261 deletions(-)
drivers/net/ethernet/freescale/fec.h +84 -24
@@ -27,8 +27,8 @@*/ #define FEC_IEVENT 0x004/* Interrupt event reg */ #define FEC_IMASK 0x008/* Interrupt mask reg */ -#define FEC_R_DES_ACTIVE 0x010/* Receive descriptor reg */ -#define FEC_X_DES_ACTIVE 0x014/* Transmit descriptor reg */ +#define FEC_R_DES_ACTIVE_0 0x010/* Receive descriptor reg */ +#define FEC_X_DES_ACTIVE_0 0x014/* Transmit descriptor reg */ #define FEC_ECNTRL 0x024/* Ethernet control reg */ #define FEC_MII_DATA 0x040/* MII manage frame reg */ #define FEC_MII_SPEED 0x044/* MII speed control reg */
@@ -45,14 +45,26 @@#define FEC_X_WMRK 0x144/* FIFO transmit water mark */ #define FEC_R_BOUND 0x14c/* FIFO receive bound reg */ #define FEC_R_FSTART 0x150/* FIFO receive start reg */ -#define FEC_R_DES_START 0x180/* Receive descriptor ring */ -#define FEC_X_DES_START 0x184/* Transmit descriptor ring */ +#define FEC_R_DES_START_1 0x160/* Receive descriptor ring 1 */ +#define FEC_X_DES_START_1 0x164/* Transmit descriptor ring 1 */ +#define FEC_R_DES_START_2 0x16c/* Receive descriptor ring 2 */ +#define FEC_X_DES_START_2 0x170/* Transmit descriptor ring 2 */ +#define FEC_R_DES_START_0 0x180/* Receive descriptor ring */ +#define FEC_X_DES_START_0 0x184/* Transmit descriptor ring */ #define FEC_R_BUFF_SIZE 0x188/* Maximum receive buff size */ #define FEC_R_FIFO_RSFL 0x190/* Receive FIFO section full threshold */ #define FEC_R_FIFO_RSEM 0x194/* Receive FIFO section empty threshold */ #define FEC_R_FIFO_RAEM 0x198/* Receive FIFO almost empty threshold */ #define FEC_R_FIFO_RAFL 0x19c/* Receive FIFO almost full threshold */ #define FEC_RACC 0x1C4/* Receive Accelerator function */ +#define FEC_RCMR_1 0x1c8/* Receive classification match ring 1 */ +#define FEC_RCMR_2 0x1cc/* Receive classification match ring 2 */ +#define FEC_DMA_CFG_1 0x1d8/* DMA class configuration for ring 1 */ +#define FEC_DMA_CFG_2 0x1dc/* DMA class Configuration for ring 2 */ +#define FEC_R_DES_ACTIVE_1 0x1e0/* Rx descriptor active for ring 1 */ +#define FEC_X_DES_ACTIVE_1 0x1e4/* Tx descriptor active for ring 1 */ +#define FEC_R_DES_ACTIVE_2 0x1e8/* Rx descriptor active for ring 2 */ +#define FEC_X_DES_ACTIVE_2 0x1ec/* Tx descriptor active for ring 2 */ #define FEC_MIIGSK_CFGR 0x300/* MIIGSK Configuration reg */ #define FEC_MIIGSK_ENR 0x308/* MIIGSK Enable reg */
@@ -240,6 +252,36 @@ struct bufdesc_ex {#define FEC_ENET_MAX_TX_QS 3#define FEC_ENET_MAX_RX_QS 3 +#define FEC_R_DES_START (X ) ((X == 1) ? FEC_R_DES_START_1 : \ + ((X == 2) ? \ + FEC_R_DES_START_2 : FEC_R_DES_START_0)) +#define FEC_X_DES_START (X ) ((X == 1) ? FEC_X_DES_START_1 : \ + ((X == 2) ? \ + FEC_X_DES_START_2 : FEC_X_DES_START_0)) +#define FEC_R_DES_ACTIVE (X ) ((X == 1) ? FEC_R_DES_ACTIVE_1 : \ + ((X == 2) ? \ + FEC_R_DES_ACTIVE_2 : FEC_R_DES_ACTIVE_0)) +#define FEC_X_DES_ACTIVE (X ) ((X == 1) ? FEC_X_DES_ACTIVE_1 : \ + ((X == 2) ? \ + FEC_X_DES_ACTIVE_2 : FEC_X_DES_ACTIVE_0)) + +#define FEC_DMA_CFG (X ) ((X == 2) ? FEC_DMA_CFG_2 : FEC_DMA_CFG_1) + +#define DMA_CLASS_EN (1 << 16) +#define FEC_RCMR (X ) ((X == 2) ? FEC_RCMR_2 : FEC_RCMR_1) +#define IDLE_SLOPE_MASK 0xFFFF +#define IDLE_SLOPE_1 0x200/* BW fraction: 0.5 */ +#define IDLE_SLOPE_2 0x200/* BW fraction: 0.5 */ +#define IDLE_SLOPE (X ) ((X == 1) ? (IDLE_SLOPE_1 & IDLE_SLOPE_MASK) : \ + (IDLE_SLOPE_2 & IDLE_SLOPE_MASK)) +#define RCMR_MATCHEN (0x1 << 16) +#define RCMR_CMP_CFG (v, n) ((v & 0x7) << (n << 2)) +#define RCMR_CMP_1 (RCMR_CMP_CFG(0, 0) | RCMR_CMP_CFG(1, 1) | \ + RCMR_CMP_CFG(2, 2) | RCMR_CMP_CFG(3, 3)) +#define RCMR_CMP_2 (RCMR_CMP_CFG(4, 0) | RCMR_CMP_CFG(5, 1) | \ + RCMR_CMP_CFG(6, 2) | RCMR_CMP_CFG(7, 3)) +#define RCMR_CMP (X ) ((X == 1) ? RCMR_CMP_1 : RCMR_CMP_2) +/* The number of Tx and Rx buffers. These are allocated from the page * pool. The code may assume these are power of two, so it it best * to keep them that size.
@@ -263,6 +305,35 @@ struct bufdesc_ex {#define FLAG_RX_CSUM_ENABLED (BD_ENET_RX_ICE | BD_ENET_RX_PCR)#define FLAG_RX_CSUM_ERROR (BD_ENET_RX_ICE | BD_ENET_RX_PCR) +struct fec_enet_priv_tx_q { +int index; +unsigned char *tx_bounce[TX_RING_SIZE ]; +struct sk_buff *tx_skbuff[TX_RING_SIZE ]; + +dma_addr_t bd_dma; +struct bufdesc *tx_bd_base; +uint tx_ring_size; + +unsigned short tx_stop_threshold; +unsigned short tx_wake_threshold; + +struct bufdesc *cur_tx; +struct bufdesc *dirty_tx; +char *tso_hdrs; +dma_addr_t tso_hdrs_dma; +}; + +struct fec_enet_priv_rx_q { +int index; +struct sk_buff *rx_skbuff[RX_RING_SIZE ]; + +dma_addr_t bd_dma; +struct bufdesc *rx_bd_base; +uint rx_ring_size; + +struct bufdesc *cur_rx; +}; +/* The FEC buffer descriptors track the ring buffers. The rx_bd_base and * tx_bd_base always point to the base of the buffer descriptors. The * cur_rx and cur_tx point to the currently available buffer.
@@ -289,29 +360,18 @@ struct fec_enet_private {int num_rx_queues;/* The saved address of a sent-in-place packet/buffer, for skfree(). */ -unsigned char *tx_bounce[TX_RING_SIZE ]; -struct sk_buff *tx_skbuff[TX_RING_SIZE ]; -struct sk_buff *rx_skbuff[RX_RING_SIZE ]; +struct fec_enet_priv_tx_q *tx_queue[FEC_ENET_MAX_TX_QS ]; +struct fec_enet_priv_rx_q *rx_queue[FEC_ENET_MAX_RX_QS ]; -/* CPM dual port RAM relative addresses */ -dma_addr_t bd_dma; -/* Address of Rx and Tx buffers */ -struct bufdesc *rx_bd_base; -struct bufdesc *tx_bd_base; -/* The next free ring entry */ -struct bufdesc *cur_rx, *cur_tx; -/* The ring entries to be free()ed */ -struct bufdesc *dirty_tx; +unsigned int total_tx_ring_size; +unsigned int total_rx_ring_size; -unsigned short bufdesc_size; -unsigned short tx_ring_size; -unsigned short rx_ring_size; -unsigned short tx_stop_threshold; -unsigned short tx_wake_threshold; +unsigned long work_tx; +unsigned long work_rx; +unsigned long work_ts; +unsigned long work_mdio; -/* Software TSO */ -char *tso_hdrs; -dma_addr_t tso_hdrs_dma; +unsigned short bufdesc_size;struct platform_device *pdev;
drivers/net/ethernet/freescale/fec_main.c +493 -237
1,200 lines not on this page · raw message
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/11 net:fec: Disable enet-avb MAC instead of reset MAC
In reply to Frank LiFrom: Fugang Duan <[email protected]>
For i.MX6SX enet use AXI bus, reset MAC will make system bus dead if ENET-AXI bus has pending access (AHB bus should not have such issue). So, disable enet with AVB MAC instead of reset MAC itself.
--- drivers/net/ethernet/freescale/fec_main.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +20 -6
@@ -948,9 +948,16 @@ fec_restart(struct net_device *ndev)u32 ecntl =0x2 ;/* ETHEREN */ int i; -/* Whack a reset. We should wait for this. */ -writel (1 , fep->hwp +FEC_ECNTRL ); -udelay (10 ); +/* Whack a reset. We should wait for this. +* For i.MX6SX SOC, enet use AXI bus, we use disable MAC +* instead of reset MAC itself. +*/ +if (id_entry && id_entry->driver_data &FEC_QUIRK_HAS_AVB ) { +writel (0 , fep->hwp +FEC_ECNTRL ); + }else { +writel (1 , fep->hwp +FEC_ECNTRL ); +udelay (10 ); + }/* * enet-mac reset will reset mac address registers too,
@@ -1122,9 +1129,16 @@ fec_stop(struct net_device *ndev)netdev_err (ndev,"Graceful transmit stop did not complete!\n" ); } -/* Whack a reset. We should wait for this. */ -writel (1 , fep->hwp +FEC_ECNTRL ); -udelay (10 ); +/* Whack a reset. We should wait for this. +* For i.MX6SX SOC, enet use AXI bus, we use disable MAC +* instead of reset MAC itself. +*/ +if (id_entry && id_entry->driver_data &FEC_QUIRK_HAS_AVB ) { +writel (0 , fep->hwp +FEC_ECNTRL ); + }else { +writel (1 , fep->hwp +FEC_ECNTRL ); +udelay (10 ); + }writel (fep->phy_speed, fep->hwp +FEC_MII_SPEED );writel (FEC_DEFAULT_IMASK , fep->hwp +FEC_IMASK );
Signature · 1 line
1.9.1
PATCH 6/11 net:fec: add enet-avb IP support
In reply to Frank Lii.MX6SX Enet-AVB support 3 tx queues, 3 rx queues. For tx queues: ring 0 -> best effort
ring 1 -> Class A ring 2 -> Class B For rx queues: ring 0 -> best effort ring 1 -> receive VLAN packet with classification match ring 2 -> receive VLAN packet with classification match
Add enet-avb IP multiqueue support for the driver.
--- drivers/net/ethernet/freescale/fec.h | 33 +++++++++++++++++++++++++++ drivers/net/ethernet/freescale/fec_main.c | 38 +++++++++++++++---------------- 2 files changed, 52 insertions(+), 19 deletions(-)
drivers/net/ethernet/freescale/fec.h +33 -0
@@ -38,6 +38,12 @@#define FEC_ADDR_LOW 0x0e4/* Low 32bits MAC address */ #define FEC_ADDR_HIGH 0x0e8/* High 16bits MAC address */ #define FEC_OPD 0x0ec/* Opcode + Pause duration */ +#define FEC_TXIC0 0xF0/* Tx Interrupt Coalescing for ring 0 */ +#define FEC_TXIC1 0xF4/* Tx Interrupt Coalescing for ring 1 */ +#define FEC_TXIC2 0xF8/* Tx Interrupt Coalescing for ring 2 */ +#define FEC_RXIC0 0x100/* Rx Interrupt Coalescing for ring 0 */ +#define FEC_RXIC1 0x104/* Rx Interrupt Coalescing for ring 1 */ +#define FEC_RXIC2 0x108/* Rx Interrupt Coalescing for ring 2 */ #define FEC_HASH_TABLE_HIGH 0x118/* High 32bits hash table */ #define FEC_HASH_TABLE_LOW 0x11c/* Low 32bits hash table */ #define FEC_GRP_HASH_TABLE_HIGH 0x120/* High 32bits hash table */
@@ -65,6 +71,7 @@#define FEC_X_DES_ACTIVE_1 0x1e4/* Tx descriptor active for ring 1 */ #define FEC_R_DES_ACTIVE_2 0x1e8/* Rx descriptor active for ring 2 */ #define FEC_X_DES_ACTIVE_2 0x1ec/* Tx descriptor active for ring 2 */ +#define FEC_QOS_SCHEME 0x1f0/* Set multi queues Qos scheme */ #define FEC_MIIGSK_CFGR 0x300/* MIIGSK Configuration reg */ #define FEC_MIIGSK_ENR 0x308/* MIIGSK Enable reg */
@@ -305,6 +312,32 @@ struct bufdesc_ex {#define FLAG_RX_CSUM_ENABLED (BD_ENET_RX_ICE | BD_ENET_RX_PCR)#define FLAG_RX_CSUM_ERROR (BD_ENET_RX_ICE | BD_ENET_RX_PCR) +/* Interrupt events/masks. */ +#define FEC_ENET_HBERR ((uint)0x80000000)/* Heartbeat error */ +#define FEC_ENET_BABR ((uint)0x40000000)/* Babbling receiver */ +#define FEC_ENET_BABT ((uint)0x20000000)/* Babbling transmitter */ +#define FEC_ENET_GRA ((uint)0x10000000)/* Graceful stop complete */ +#define FEC_ENET_TXF_0 ((uint)0x08000000)/* Full frame transmitted */ +#define FEC_ENET_TXF_1 ((uint)0x00000008)/* Full frame transmitted */ +#define FEC_ENET_TXF_2 ((uint)0x00000080)/* Full frame transmitted */ +#define FEC_ENET_TXB ((uint)0x04000000)/* A buffer was transmitted */ +#define FEC_ENET_RXF_0 ((uint)0x02000000)/* Full frame received */ +#define FEC_ENET_RXF_1 ((uint)0x00000002)/* Full frame received */ +#define FEC_ENET_RXF_2 ((uint)0x00000020)/* Full frame received */ +#define FEC_ENET_RXB ((uint)0x01000000)/* A buffer was received */ +#define FEC_ENET_MII ((uint)0x00800000)/* MII interrupt */ +#define FEC_ENET_EBERR ((uint)0x00400000)/* SDMA bus error */ +#define FEC_ENET_TXF (FEC_ENET_TXF_0 | FEC_ENET_TXF_1 | FEC_ENET_TXF_2) +#define FEC_ENET_RXF (FEC_ENET_RXF_0 | FEC_ENET_RXF_1 | FEC_ENET_RXF_2) +#define FEC_ENET_TS_AVAIL ((uint)0x00010000) +#define FEC_ENET_TS_TIMER ((uint)0x00008000) + +#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII | FEC_ENET_TS_TIMER) +#define FEC_RX_DISABLED_IMASK (FEC_DEFAULT_IMASK & (~FEC_ENET_RXF)) + +#define FEC_VLAN_TAG_LEN 0x04 +#define FEC_ETHTYPE_LEN 0x02 +struct fec_enet_priv_tx_q {int index;unsigned char *tx_bounce[TX_RING_SIZE ];
drivers/net/ethernet/freescale/fec_main.c +19 -19
@@ -193,21 +193,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");#endif #endif /* CONFIG_M5272 */ -/* Interrupt events/masks. */ -#define FEC_ENET_HBERR ((uint)0x80000000)/* Heartbeat error */ -#define FEC_ENET_BABR ((uint)0x40000000)/* Babbling receiver */ -#define FEC_ENET_BABT ((uint)0x20000000)/* Babbling transmitter */ -#define FEC_ENET_GRA ((uint)0x10000000)/* Graceful stop complete */ -#define FEC_ENET_TXF ((uint)0x08000000)/* Full frame transmitted */ -#define FEC_ENET_TXB ((uint)0x04000000)/* A buffer was transmitted */ -#define FEC_ENET_RXF ((uint)0x02000000)/* Full frame received */ -#define FEC_ENET_RXB ((uint)0x01000000)/* A buffer was received */ -#define FEC_ENET_MII ((uint)0x00800000)/* MII interrupt */ -#define FEC_ENET_EBERR ((uint)0x00400000)/* SDMA bus error */ - -#define FEC_DEFAULT_IMASK (FEC_ENET_TXF | FEC_ENET_RXF | FEC_ENET_MII) -#define FEC_RX_DISABLED_IMASK (FEC_DEFAULT_IMASK & (~FEC_ENET_RXF)) -/* The FEC stores dest/src/type/vlan, data, and checksum for receive packets. */ #define PKT_MAXBUF_SIZE 1522
@@ -885,7 +870,16 @@ static void fec_enet_bd_init(struct net_device *dev) } } -static inline void fec_enet_enable_ring (struct net_device *ndev) +static void fec_enet_active_rxring (struct net_device *ndev) +{ +struct fec_enet_private *fep =netdev_priv (ndev); +int i; + +for (i =0 ; i < fep->num_rx_queues; i++) +writel (0 , fep->hwp +FEC_R_DES_ACTIVE (i)); +} + +static void fec_enet_enable_ring (struct net_device *ndev) {struct fec_enet_private *fep =netdev_priv (ndev);struct fec_enet_priv_tx_q *tx_queue;
@@ -946,7 +940,6 @@ fec_restart(struct net_device *ndev)u32 temp_mac[2 ];u32 rcntl =OPT_FRAME_SIZE |0x04 ;u32 ecntl =0x2 ;/* ETHEREN */ -int i;/* Whack a reset. We should wait for this. * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
@@ -1103,8 +1096,7 @@ fec_restart(struct net_device *ndev)/* And last, enable the transmit and receive processing */ writel (ecntl, fep->hwp +FEC_ECNTRL ); -for (i =0 ; i < fep->num_rx_queues; i++) -writel (0 , fep->hwp +FEC_R_DES_ACTIVE (i)); +fec_enet_active_rxring (ndev);if (fep->bufdesc_ex)fec_ptp_start_cyclecounter (ndev);
@@ -1515,9 +1507,17 @@ fec_enet_collect_events(struct fec_enet_private *fep, uint int_events)if (int_events &FEC_ENET_RXF ) fep->work_rx |= (1 <<2 ); +if (int_events &FEC_ENET_RXF_1 ) + fep->work_rx |= (1 <<0 ); +if (int_events &FEC_ENET_RXF_2 ) + fep->work_rx |= (1 <<1 );if (int_events &FEC_ENET_TXF ) fep->work_tx |= (1 <<2 ); +if (int_events &FEC_ENET_TXF_1 ) + fep->work_tx |= (1 <<0 ); +if (int_events &FEC_ENET_TXF_2 ) + fep->work_tx |= (1 <<1 );return true; }
Signature · 1 line
1.9.1
PATCH 7/11 net:fec: Add fsl,imx6sx-fec compatible strings
In reply to Frank LiFrom: Fugang Duan <[email protected]>
Add compatible string "fsl,imx6sx-fec" for i.MX6SX.
--- drivers/net/ethernet/freescale/fec_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/fec_main.c +2 -0
@@ -157,6 +157,7 @@ enum imx_fec_type {IMX28_FEC ,IMX6Q_FEC ,MVF600_FEC , + IMX6SX_FEC, }; static const struct of_device_id fec_dt_ids[] = {
@@ -165,6 +166,7 @@ static const struct of_device_id fec_dt_ids[] = { { .compatible = "fsl,imx28-fec", .data = &fec_devtype[IMX28_FEC], }, { .compatible = "fsl,imx6q-fec", .data = &fec_devtype[IMX6Q_FEC], }, { .compatible = "fsl,mvf600-fec", .data = &fec_devtype[MVF600_FEC], }, + { .compatible = "fsl,imx6sx-fec", .data = &fec_devtype[IMX6SX_FEC], }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fec_dt_ids);
Signature · 1 line
1.9.1
PATCH 8/11 net:fec: change FEC alignment to 64 bytes for ARM platform
In reply to a message not in the archiveFrom: Fugang Duan <[email protected]>
Since enet-avb has 64 bytes alignment limitation for rx DMA transfer. The previous enet IP for ARM platform has 16 bytes alignment for tx DMA transfer. 64 is the an integral number of 16, so change alignment to 64 bytes for all ARM platform, which don't impact the performance of previous platform.
--- drivers/net/ethernet/freescale/fec_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +1 -1
@@ -65,7 +65,7 @@static void set_multicast_list (struct net_device *ndev);#if defined(CONFIG_ARM ) -#define FEC_ALIGNMENT 0xf +#define FEC_ALIGNMENT 0x3f#else #define FEC_ALIGNMENT 0x3#endif
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/11 net:fec: remove unnessary memory copy for address alignment in .xmit()
In reply to a message not in the archiveFrom: Fugang Duan <[email protected]>
i.MX6SX enet-avb IP support buffer address byte alignment for tx DMA transfer, so remove the unnessary memory copy for the enet avb IP.
--- drivers/net/ethernet/freescale/fec_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +3 -2
@@ -518,8 +518,9 @@ static int fec_enet_txq_submit_skb(struct fec_enet_priv_tx_q *txq, queue =skb_get_queue_mapping (skb); index =fec_enet_get_bd_index (txq->tx_bd_base, bdp, fep); -if (((unsigned long ) bufaddr) &FEC_ALIGNMENT || - id_entry->driver_data &FEC_QUIRK_SWAP_FRAME ) { +if (!(id_entry->driver_data &FEC_QUIRK_HAS_AVB ) && + ((((unsigned long )bufaddr) &FEC_ALIGNMENT || + id_entry->driver_data &FEC_QUIRK_SWAP_FRAME ))) {memcpy (txq->tx_bounce[index], skb->data, buflen); bufaddr = txq->tx_bounce[index];
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/11 ARM: Documentation: Update fec dts binding doc
In reply to a message not in the archiveThis patch update fec devicetree binding doc that add Optional properties "fsl,num_tx_queues" and "fsl,num_rx_queues".
--- Documentation/devicetree/bindings/net/fsl-fec.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/net/fsl-fec.txt +6 -0
@@ -16,6 +16,12 @@ Optional properties: - phy-handle : phandle to the PHY device connected to this device. - fixed-link : Assume a fixed link. See fixed-link.txt in the same directory. Use instead of phy-handle. +- fsl,num_tx_queues : The property is valid for enet-avb IP, which supports + hw multi queues. Should specify the tx queue number, otherwise set tx queue + number to 1. +- fsl,num_rx_queues : The property is valid for enet-avb IP, which supports + hw multi queues. Should specify the rx queue number, otherwise set rx queue + number to 1. Optional subnodes: - mdio : specifies the mdio bus in the FEC, used as a container for phy nodes
Signature · 6 lines
1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/11 ARM: dts: imx6sx: add multi-queue support enet
In reply to Frank LiEnable 3 queues suppport for ethernet
--- arch/arm/boot/dts/imx6sx.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/imx6sx.dtsi +2 -0
@@ -776,6 +776,8 @@ <&clks IMX6SX_CLK_ENET_PTP>; clock-names = "ipg", "ahb", "ptp", "enet_clk_ref", "enet_out"; + fsl,num_tx_queues=<3>; + fsl,num_rx_queues=<3>; status = "disabled"; };
Signature · 1 line
1.9.1
Re: [Patch net-next 03/11] net:fec: use multiqueue interface to allocate Ethernet device
In reply to Frank LiQuoted 31 lines · Frank Li
From: Fugang Duan <[email protected]>
Since i.MX6SX enet-AVB IP support multi queues, so use multi queues interface to allocate and set up an Ethernet device.
Signed-off-by Fugang Duan <[email protected]>Signed-off-by Frank Li <[email protected]>--- drivers/net/ethernet/freescale/fec.h | 9 ++++++ drivers/net/ethernet/freescale/fec_main.c | 49 ++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-)drivers/net/ethernet/freescale/fec.h +7
-0@@ -233,6 +233,13 @@ struct bufdesc_ex {/* This device has up to three irqs on some platforms */ #define FEC_IRQ_NUM 3 +/* Maximum number of queues supported +* ENET with AVB IP can support up to 3 independent tx queues and rx queues. +* User can point the queue number that is less than or equal to 3. +*/ +#define FEC_ENET_MAX_TX_QS 3 +#define FEC_ENET_MAX_RX_QS 3 +/* The number of Tx and Rx buffers. These are allocated from the page * pool. The code may assume these are power of two, so it it best * to keep them that size.
drivers/net/ethernet/freescale/fec.h struct fec_enet_private { · line 289
Quoted 5 lines
drivers/net/ethernet/freescale/fec.h +2
-0@@ -278,6 +285,8 @@ struct fec_enet_private {bool ptp_clk_on;struct mutex ptp_clk_mutex; +int num_tx_queues; +int num_rx_queues;
unsigned int.
Quoted 8 lines
drivers/net/ethernet/freescale/fec.h +0
-0/* The saved address of a sent-in-place packet/buffer, for skfree(). */ unsigned char *tx_bounce[TX_RING_SIZE ];drivers/net/ethernet/freescale/fec_main.c +0
-0
drivers/net/ethernet/freescale/fec_main.c static void fec_reset_phy(struct platform_device *pdev) · line 2582
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +7
-0@@ -2573,6 +2573,39 @@ static void fec_reset_phy(struct platform_device *pdev)#endif /* CONFIG_OF */ static int +fec_enet_get_queue_num (struct platform_device *pdev,int *num_tx,int *num_rx) +{ +struct device_node *np = pdev->dev.of_node; +int err; + +if (!np || !of_device_is_available (np)) +return -ENODEV ;
This effectively breaks non-DT platform probing, is that intentional? How about assining *num_tx and *num_rx to 1, and if you find the property, use it?
Quoted 5 lines
drivers/net/ethernet/freescale/fec_main.c +5
-0+ +/* parse the num of tx and rx queues */ + err =of_property_read_u32 (np,"fsl,num_tx_queues" , num_tx); + err |=of_property_read_u32 (np,"fsl,num_rx_queues" , num_rx); +if (err) {
drivers/net/ethernet/freescale/fec_main.c static void fec_reset_phy(struct platform_device *pdev) · line 2597
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +10
-0+ *num_tx =1 ; + *num_rx =1 ; +return 0 ; + } + +if (*num_tx <1 || *num_tx >FEC_ENET_MAX_TX_QS ) { +dev_err (&pdev->dev,"num_tx(=%d) greater than MAX_TX_QS(=%d)\n" , + *num_tx,FEC_ENET_MAX_TX_QS ); +return -EINVAL ; + }
You are dealing with two error conditions here, *num_tx == 0 and *num_tx
drivers/net/ethernet/freescale/fec_main.c static void fec_reset_phy(struct platform_device *pdev) · line 2603
Quoted 8 lines
FEC_ENET_MAX_TX_QS, so the message should not be "greater than"drivers/net/ethernet/freescale/fec_main.c +6
-0+ +if (*num_rx <1 || *num_rx >FEC_ENET_MAX_RX_QS ) { +dev_err (&pdev->dev,"num_rx(=%d) greater than MAX_RX_QS(=%d)\n" , + *num_rx,FEC_ENET_MAX_RX_QS ); +return -EINVAL ; + }
Same here.
Quoted 15 lines
drivers/net/ethernet/freescale/fec_main.c +7
-0+ +return 0 ; +} + +static int fec_probe (struct platform_device *pdev) {struct fec_enet_private *fep;@@ -2583,13 +2616,23 @@ fec_probe(struct platform_device *pdev)const struct of_device_id *of_id;static int dev_id;struct device_node *np = pdev->dev.of_node, *phy_node; +int num_tx_qs =1 ; +int num_rx_qs =1 ;
drivers/net/ethernet/freescale/fec_main.c fec_probe(struct platform_device *pdev) · line 2631
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +6
-0of_id =of_match_device (fec_dt_ids, &pdev->dev);if (of_id) pdev->id_entry = of_id->data; +if (pdev->id_entry && + (pdev->id_entry->driver_data &FEC_QUIRK_HAS_AVB )) { + ret =fec_enet_get_queue_num (pdev, &num_tx_qs, &num_rx_qs); +if (ret) +return ret; + }
This should be made a void function in order no to break non-DT probing as mentioned before.
Quoted 9 lines
drivers/net/ethernet/freescale/fec_main.c +3
-1+/* Init network device */ - ndev =alloc_etherdev (sizeof (struct fec_enet_private )); + ndev =alloc_etherdev_mqs (sizeof (struct fec_enet_private ), + num_tx_qs, num_rx_qs);if (!ndev)return -ENOMEM ;
drivers/net/ethernet/freescale/fec_main.c fec_probe(struct platform_device *pdev) · line 2646
Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +3
-0@@ -2598,6 +2641,10 @@ fec_probe(struct platform_device *pdev)/* setup board info structure */ fep =netdev_priv (ndev); + fep->num_rx_queues = num_rx_qs; + fep->num_tx_queues = num_tx_qs; +netif_set_real_num_rx_queues (ndev, num_rx_qs);
How about netif_set_real_num_tx_queues? This is probably useless anyway because you already allocated this network device with the correct (supposedly) number of TX and RX queues coming from the platform configuration data.
Quoted 5 lines
drivers/net/ethernet/freescale/fec_main.c +1
-0+#if !defined(CONFIG_M5272 )/* default enable pause frame auto negotiation */ if (pdev->id_entry &&
Re: [Patch net-next 04/11] net:fec: add multiqueue support
In reply to Frank LiQuoted 7 lines · Frank Li
From: Fugang Duan <[email protected]>
Add multiqueue support, which is compatible with previous single queue driver for FEC/ENET IPs.
By default, the tx/rx queue number is 1, user can config the queue number at DTS file like this:
Quoted 8 lines
fsl,num_tx_queues=<3>; fsl,num_rx_queues=<3>;Ethernet multiqueue mechanism can improve performance in SMP system. For single hw queue, multiqueue can balance cpu loading.
For multi hw queues, multiple cores can process network packets in parallel, and refer the article for the detail advantage for multiqueue:
http://vger.kernel.org/~davem/davem_nyc09.pdf
You should probably split that patch in a minimum of two, or more different parts.
Two parts:
- add TX multiqueue support
- add RX multiqueue support
More parts:
- prepare for TX multiqueue (introduce queue structure, definitions)
- transition TX path to use queue 0
- add support for the two other TX queues
- prepare for RX multiqueue (introduce queue structure, definitions)
- prepare for multiqueue, hardcode RX path to use queue 0
- add support for the two other RX queues
The number of changes are extremely hard to review... --
Florian
Re: [Patch net-next 04/11] net:fec: add multiqueue support
In reply to a message not in the archiveQuoted 17 lines · Florian Fainelli
Quoted 7 lines · Frank Li
From: Fugang Duan <[email protected]>
Add multiqueue support, which is compatible with previous single queue driver for FEC/ENET IPs.
By default, the tx/rx queue number is 1, user can config the queue number at DTS file like this:
Quoted 8 lines
fsl,num_tx_queues=<3>; fsl,num_rx_queues=<3>;Ethernet multiqueue mechanism can improve performance in SMP system. For single hw queue, multiqueue can balance cpu loading.
For multi hw queues, multiple cores can process network packets in parallel, and refer the article for the detail advantage for multiqueue:
http://vger.kernel.org/~davem/davem_nyc09.pdf
Quoted 8 lines
You should probably split that patch in a minimum of two, or more different parts.
Two parts:
- add TX multiqueue support
- add RX multiqueue support
I understood your concern.
We also need consider logical integration.
Separate this patch just reduce changed lines in a patch. Most of this patch change is from fep-> to txq-> or rxq->
best regards
Frank Li
Quoted 12 lines
More parts:
- prepare for TX multiqueue (introduce queue structure, definitions)
- transition TX path to use queue 0
- add support for the two other TX queues
- prepare for RX multiqueue (introduce queue structure, definitions)
- prepare for multiqueue, hardcode RX path to use queue 0
- add support for the two other RX queuesThe number of changes are extremely hard to review... --
Florian
Re: [Patch net-next 04/11] net:fec: add multiqueue support
2014-09-03 20:41 GMT-07:00 Zhi Li <[email protected]>:
Quoted 21 lines · Florian Fainelli
Quoted 20 lines · Frank Li
Quoted 7 lines
From: Fugang Duan <[email protected]>
Add multiqueue support, which is compatible with previous single queue driver for FEC/ENET IPs.
By default, the tx/rx queue number is 1, user can config the queue number at DTS file like this:
Quoted 8 lines
fsl,num_tx_queues=<3>; fsl,num_rx_queues=<3>;Ethernet multiqueue mechanism can improve performance in SMP system. For single hw queue, multiqueue can balance cpu loading.
For multi hw queues, multiple cores can process network packets in parallel, and refer the article for the detail advantage for multiqueue:
http://vger.kernel.org/~davem/davem_nyc09.pdfYou should probably split that patch in a minimum of two, or more different parts.
Quoted 8 lines
Quoted 5 lines
Two parts:
- add TX multiqueue support
- add RX multiqueue supportI understood your concern.
We also need consider logical integration.
Sure, hence the reason why I suggest you make it happen in different parts, what you can do is make sure that you parse "fsl,num_tx_queues" and "fsl,num_rx_queues" as one of the last patches in this patch series. That way, we achieve a logical breakdown of the changes and only support and enable multiqueue when the driver is ready.
Quoted 2 lines
Separate this patch just reduce changed lines in a patch.
That is exactly my point, right now there is too much churn to make a reviewer able to spot potential problems.
Quoted 17 lines
Most of this patch change is from fep-> to txq-> or rxq->
best regards
Frank LiQuoted 12 lines
More parts:
- prepare for TX multiqueue (introduce queue structure, definitions)
- transition TX path to use queue 0
- add support for the two other TX queues
- prepare for RX multiqueue (introduce queue structure, definitions)
- prepare for multiqueue, hardcode RX path to use queue 0
- add support for the two other RX queuesThe number of changes are extremely hard to review... --
Florian
Signature · 1 line
Florian
PATCH 8/11 net:fec: change FEC alignment to 64 bytes for ARM platform
In reply to Frank LiFrom: Frank Li
Quoted 5 lines
From: Fugang Duan <[email protected]>
Since enet-avb has 64 bytes alignment limitation for rx DMA transfer. The previous enet IP for ARM platform has 16 bytes alignment for tx DMA transfer.
Do you mean rx or tx here? or both??
And can we beat up the hardware designers to stop these restrictions on rx (in particular) ethernet buffer alignments?
A device isn't suitable for ethernet unless is can write the destination mac address to a 4n+2 boundary.
David
Quoted 30 lines
64 is the an integral number of 16, so change alignment to 64 bytes for all ARM platform, which don't impact the performance of previous platform.
Signed-off-by Fugang Duan <[email protected]>Signed-off-by Frank Li <[email protected]>--- drivers/net/ethernet/freescale/fec_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/freescale/fec_main.c +1
-2@@ -65,7 +65,7 @@static void set_multicast_list (struct net_device *ndev);#if defined(CONFIG_ARM ) -#define FEC_ALIGNMENT 0xf +#define FEC_ALIGNMENT 0x3f#else #define FEC_ALIGNMENT 0x3#endif --1.9.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/11 net:fec: change FEC alignment to 64 bytes for ARM platform
From: David Laight <[email protected]> Sent: Thursday, September 04, 2014 4:51 PM
Quoted 14 lines
To: Li Frank-B20596; Duan Fugang-B38611; davem at davemloft.net; netdev at vger.kernel.org; lznuaa at gmail.com
Cc: shawn.guo at linaro.org; linux-arm-kernel at lists.infradead.org; devicetree at vger.kernel.org; Duan Fugang-B38611
Subject: RE: [Patch net-next 08/11] net:fec: change FEC alignment to 64 bytes for ARM platformFrom: Frank Li
Quoted 5 lines
From: Fugang Duan <[email protected]>
Since enet-avb has 64 bytes alignment limitation for rx DMA transfer. The previous enet IP for ARM platform has 16 bytes alignment for tx DMA transfer.
Quoted 9 lines
Do you mean rx or tx here? or both??
And can we beat up the hardware designers to stop these restrictions on rx (in particular) ethernet buffer alignments?
A device isn't suitable for ethernet unless is can write the destination mac address to a 4n+2 boundary.David
Hi, David,
For previous enet IP there has 16 bytes data buffer alignment limitation for tx & rx DMA transfer.
For imx6sx enet-avb IP, there has 64 bytes data buffer alignment limitation for rx DMA transfer, byte alignment for tx data Buffer for DMA transfer.
I think rx data buffer alignment limitation don't introduce performance drop, is not complex for sw implemention. Anyway, We can request IC designer to remove the limitation for future chips.
Thanks,
Andy
Quoted 31 lines
Quoted 31 lines
64 is the an integral number of 16, so change alignment to 64 bytes for all ARM platform, which don't impact the performance of previous platform.
Signed-off-by Fugang Duan <[email protected]>Signed-off-by Frank Li <[email protected]>--- drivers/net/ethernet/freescale/fec_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/freescale/fec_main.c +1
-2@@ -65,7 +65,7 @@static void set_multicast_list (struct net_device *ndev);#if defined(CONFIG_ARM ) -#define FEC_ALIGNMENT 0xf +#define FEC_ALIGNMENT 0x3f#else #define FEC_ALIGNMENT 0x3#endif --1.9.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/11 net:fec: change FEC alignment to 64 bytes for ARM platform
From: [email protected]
Quoted 18 lines
Quoted 7 lines
From: Frank Li
Quoted 5 lines
From: Fugang Duan <[email protected]>
Since enet-avb has 64 bytes alignment limitation for rx DMA transfer. The previous enet IP for ARM platform has 16 bytes alignment for tx DMA transfer.
Quoted 9 lines
Do you mean rx or tx here? or both??
And can we beat up the hardware designers to stop these restrictions on rx (in particular) ethernet buffer alignments?
A device isn't suitable for ethernet unless is can write the destination mac address to a 4n+2 boundary.David
Hi, David,
Quoted 8 lines
For previous enet IP there has 16 bytes data buffer alignment limitation for tx & rx DMA transfer. For imx6sx enet-avb IP, there has 64 bytes data buffer alignment limitation for rx DMA transfer, byte alignment for tx data
Buffer for DMA transfer.I think rx data buffer alignment limitation don't introduce performance drop, is not complex for sw implemention. Anyway,
We can request IC designer to remove the limitation for future chips.
The 'problem' is that you need the IP header to be 32bit aligned. If the dma buffer has to be aligned then the code either has to do an expensive misaligned copy of the entire frame (at some point the entire frame is almost certainly all copied into an aligned buffer), or take the hit of misaligned memory accesses (which might have to be emulated with byte transfers).
The rx buffer can be aligned provided the hardware skips (or writes junk to) the first two bytes.
David
Re: [Patch net-next 04/11] net:fec: add multiqueue support
In reply to Florian FainelliQuoted 28 lines · Florian Fainelli
2014-09-03 20:41 GMT-07:00 Zhi Li <[email protected]>:
Quoted 27 lines · Florian Fainelli
Quoted 25 lines · Frank Li
Quoted 7 lines
From: Fugang Duan <[email protected]>
Add multiqueue support, which is compatible with previous single queue driver for FEC/ENET IPs.
By default, the tx/rx queue number is 1, user can config the queue number at DTS file like this:
Quoted 8 lines
fsl,num_tx_queues=<3>; fsl,num_rx_queues=<3>;Ethernet multiqueue mechanism can improve performance in SMP system. For single hw queue, multiqueue can balance cpu loading.
For multi hw queues, multiple cores can process network packets in parallel, and refer the article for the detail advantage for multiqueue:
http://vger.kernel.org/~davem/davem_nyc09.pdfYou should probably split that patch in a minimum of two, or more different parts.
Two parts:
- add TX multiqueue support
- add RX multiqueue support
Quoted 8 lines
Quoted 2 lines
I understood your concern.
We also need consider logical integration.Sure, hence the reason why I suggest you make it happen in different parts, what you can do is make sure that you parse "fsl,num_tx_queues" and "fsl,num_rx_queues" as one of the last patches in this patch series. That way, we achieve a logical breakdown of the changes and only support and enable multiqueue when the driver is ready.
I can remove this part to "net:fec: add enet-avb IP support", last patch just change DT file,
which come into difference maintainer.
But RX and TX is difficult to separate because RX and TX share some function, such asfec_enet_get_nextdesc
If I change TX part, fec_enet_get_nextdesc will add a parameter. If that, all RX part need be
changed.
Quoted 29 lines
Quoted 3 lines
Separate this patch just reduce changed lines in a patch.
That is exactly my point, right now there is too much churn to make a reviewer able to spot potential problems.
Quoted 17 lines
Most of this patch change is from fep-> to txq-> or rxq->
best regards
Frank LiQuoted 12 lines
More parts:
- prepare for TX multiqueue (introduce queue structure, definitions)
- transition TX path to use queue 0
- add support for the two other TX queues
- prepare for RX multiqueue (introduce queue structure, definitions)
- prepare for multiqueue, hardcode RX path to use queue 0
- add support for the two other RX queuesThe number of changes are extremely hard to review... --
Florian--
Florian
Re: [Patch net-next 08/11] net:fec: change FEC alignment to 64 bytes for ARM platform
In reply to David LaightQuoted 28 lines · David Laight
From: fugang.duan at freescale.com
Quoted 18 lines
Quoted 7 lines
From: Frank Li
Quoted 5 lines
From: Fugang Duan <[email protected]>
Since enet-avb has 64 bytes alignment limitation for rx DMA transfer. The previous enet IP for ARM platform has 16 bytes alignment for tx DMA transfer.
Quoted 9 lines
Do you mean rx or tx here? or both??
And can we beat up the hardware designers to stop these restrictions on rx (in particular) ethernet buffer alignments?
A device isn't suitable for ethernet unless is can write the destination mac address to a 4n+2 boundary.David
Hi, David,
Quoted 8 lines
For previous enet IP there has 16 bytes data buffer alignment limitation for tx & rx DMA transfer. For imx6sx enet-avb IP, there has 64 bytes data buffer alignment limitation for rx DMA transfer, byte alignment for tx data
Buffer for DMA transfer.I think rx data buffer alignment limitation don't introduce performance drop, is not complex for sw implemention. Anyway,
We can request IC designer to remove the limitation for future chips.
Quoted 8 lines
The 'problem' is that you need the IP header to be 32bit aligned. If the dma buffer has to be aligned then the code either has to do an expensive misaligned copy of the entire frame (at some point the entire frame is almost certainly all copied into an aligned buffer), or take the hit of misaligned memory accesses (which might have to be emulated with byte transfers).
The rx buffer can be aligned provided the hardware skips (or writes junk to) the first two bytes.
ENET IP have feature to add additional 2 byte when save data to memory.
RX FIFO Shift-16
When this field is set, the actual frame data starts at bit 16 of the first word read from the RX FIFO aligning
the Ethernet payload on a 32-bit boundary.
NOTE: This function only affects the FIFO storage and has no influence on the statistics, which use the
actual length of the frame received.
0 Disabled.
1 Instructs the MAC to write two additional bytes in front of each frame received into the RX FIFO.
i.MX6SX,
Remove TX alignment requirement.
But RX and DMA BD address is 64byte aligment.
best regards
Frank Li
Quoted 5 lines
David