net: mvpp2: add BM protection underrun feature support
Subsystems (5)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v7 2/15 dts: marvell: add CM3 SRAM memory to cp115 ethernet device tree
From: Konstantin Porotchkin <[email protected]>
CM3 SRAM address space would be used for Flow Control configuration.
--- arch/arm64/boot/dts/marvell/armada-cp11x.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/marvell/armada-cp11x.dtsi +10 -0
@@ -69,6 +69,8 @@ status = "disabled"; dma-coherent; + cm3-mem = <&CP11X_LABEL(cm3_sram)>; + CP11X_LABEL(eth0): eth0 { interrupts = <39 IRQ_TYPE_LEVEL_HIGH>, <43 IRQ_TYPE_LEVEL_HIGH>,
@@ -211,6 +213,14 @@ }; }; + CP11X_LABEL(cm3_sram): cm3@220000 { + compatible = "mmio-sram"; + reg = <0x220000 0x800>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x220000 0x800>; + }; + CP11X_LABEL(rtc): rtc@284000 { compatible = "marvell,armada-8k-rtc"; reg = <0x284000 0x20>, <0x284080 0x24>;
Signature · 1 line
1.9.1
PATCH v7 10/15 net: mvpp2: add RXQ flow control configurations
In reply to a message not in the archiveFrom: Stefan Chulski <[email protected]>
This patch adds RXQ flow control configurations.
Flow control disabled by default.
Minimum ring size limited to 1024 descriptors.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 35 +++++- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 116 ++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +34 -1
@@ -766,9 +766,36 @@#define MSS_SRAM_SIZE 0x800#define MSS_FC_COM_REG 0#define FLOW_CONTROL_ENABLE_BIT BIT(0) +#define FLOW_CONTROL_UPDATE_COMMAND_BIT BIT(31)#define FC_QUANTA 0xFFFF#define FC_CLK_DIVIDER 100 -#define MSS_THRESHOLD_STOP 768 + +#define MSS_RXQ_TRESH_BASE 0x200 +#define MSS_RXQ_TRESH_OFFS 4 +#define MSS_RXQ_TRESH_REG (q, fq) (MSS_RXQ_TRESH_BASE + (((q) + (fq)) \ + * MSS_RXQ_TRESH_OFFS)) + +#define MSS_RXQ_TRESH_START_MASK 0xFFFF +#define MSS_RXQ_TRESH_STOP_MASK (0xFFFF << MSS_RXQ_TRESH_STOP_OFFS) +#define MSS_RXQ_TRESH_STOP_OFFS 16 + +#define MSS_RXQ_ASS_BASE 0x80 +#define MSS_RXQ_ASS_OFFS 4 +#define MSS_RXQ_ASS_PER_REG 4 +#define MSS_RXQ_ASS_PER_OFFS 8 +#define MSS_RXQ_ASS_PORTID_OFFS 0 +#define MSS_RXQ_ASS_PORTID_MASK 0x3 +#define MSS_RXQ_ASS_HOSTID_OFFS 2 +#define MSS_RXQ_ASS_HOSTID_MASK 0x3F + +#define MSS_RXQ_ASS_Q_BASE (q, fq) ((((q) + (fq)) % MSS_RXQ_ASS_PER_REG) \ + * MSS_RXQ_ASS_PER_OFFS) +#define MSS_RXQ_ASS_PQ_BASE (q, fq) ((((q) + (fq)) / MSS_RXQ_ASS_PER_REG) \ + * MSS_RXQ_ASS_OFFS) +#define MSS_RXQ_ASS_REG (q, fq) (MSS_RXQ_ASS_BASE + MSS_RXQ_ASS_PQ_BASE(q, fq)) + +#define MSS_THRESHOLD_STOP 768 +#define MSS_THRESHOLD_START 1024/* RX buffer constants */ #define MVPP2_SKB_SHINFO_SIZE \
@@ -1026,6 +1053,9 @@ struct mvpp2 {/* Global TX Flow Control config */ bool global_tx_fc; + +/* Spinlocks for CM3 shared memory configuration */ +spinlock_t mss_spinlock; };struct mvpp2_pcpu_stats {
@@ -1188,6 +1218,9 @@ struct mvpp2_port {bool rx_hwtstamp;enum hwtstamp_tx_types tx_hwtstamp_type;struct mvpp2_hwtstamp_queue tx_hwtstamp_queue[2 ]; + +/* Firmware TX flow control */ +bool tx_fc; };/* The mvpp2_tx_desc and mvpp2_rx_desc structures describe the
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +116 -0
146 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v7 11/15 net: mvpp2: add ethtool flow control configuration support
In reply to a message not in the archiveFrom: Stefan Chulski <[email protected]>
This patch add ethtool flow control configuration support.
Tx flow control retrieved correctly by ethtool get function. FW per port ethtool configuration capability added.
Patch also takes care about mtu change procedure, if PPv2 switch BM pools during mtu change.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 13 +++ drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 98 ++++++++++++++++++++ 2 files changed, 111 insertions(+)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +13 -0
@@ -775,6 +775,19 @@#define MSS_RXQ_TRESH_REG (q, fq) (MSS_RXQ_TRESH_BASE + (((q) + (fq)) \ * MSS_RXQ_TRESH_OFFS)) +#define MSS_BUF_POOL_BASE 0x40 +#define MSS_BUF_POOL_OFFS 4 +#define MSS_BUF_POOL_REG (id) (MSS_BUF_POOL_BASE \ + + (id) * MSS_BUF_POOL_OFFS) + +#define MSS_BUF_POOL_STOP_MASK 0xFFF +#define MSS_BUF_POOL_START_MASK (0xFFF << MSS_BUF_POOL_START_OFFS) +#define MSS_BUF_POOL_START_OFFS 12 +#define MSS_BUF_POOL_PORTS_MASK (0xF << MSS_BUF_POOL_PORTS_OFFS) +#define MSS_BUF_POOL_PORTS_OFFS 24 +#define MSS_BUF_POOL_PORT_OFFS (id) (0x1 << \ + ((id) + MSS_BUF_POOL_PORTS_OFFS)) +#define MSS_RXQ_TRESH_START_MASK 0xFFFF#define MSS_RXQ_TRESH_STOP_MASK (0xFFFF << MSS_RXQ_TRESH_STOP_OFFS)#define MSS_RXQ_TRESH_STOP_OFFS 16
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +98 -0
128 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v7 12/15 net: mvpp2: add BM protection underrun feature support
In reply to a message not in the archiveFrom: Stefan Chulski <[email protected]>
Feature double size of BPPI by decreasing number of pools from 16 to 8. Increasing of BPPI size protect BM drop from BPPI underrun. Underrun could occurred due to stress on DDR and as result slow buffer transition from BPPE to BPPI.
New BPPI threshold recommended by spec is:
BPPI low threshold - 640 buffers
BPPI high threshold - 832 buffers
Supported only in PPv23.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 8 +++++ drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 35 +++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +8 -0
@@ -324,6 +324,10 @@#define MVPP2_BM_HIGH_THRESH_MASK 0x7f0000#define MVPP2_BM_HIGH_THRESH_VALUE (val) ((val) << \ MVPP2_BM_HIGH_THRESH_OFFS) +#define MVPP2_BM_BPPI_HIGH_THRESH 0x1E +#define MVPP2_BM_BPPI_LOW_THRESH 0x1C +#define MVPP23_BM_BPPI_HIGH_THRESH 0x34 +#define MVPP23_BM_BPPI_LOW_THRESH 0x28#define MVPP2_BM_INTR_CAUSE_REG (pool) (0x6240 + ((pool) * 4))#define MVPP2_BM_RELEASED_DELAY_MASK BIT(0)#define MVPP2_BM_ALLOC_FAILED_MASK BIT(1)
@@ -352,6 +356,10 @@#define MVPP2_OVERRUN_ETH_DROP 0x7000#define MVPP2_CLS_ETH_DROP 0x7020 +#define MVPP22_BM_POOL_BASE_ADDR_HIGH_REG 0x6310 +#define MVPP22_BM_POOL_BASE_ADDR_HIGH_MASK 0xff +#define MVPP23_BM_8POOL_MODE BIT(8) +/* Hit counters registers */ #define MVPP2_CTRS_IDX 0x7040#define MVPP22_CTRS_TX_CTR (port, txq) ((txq) | ((port) << 3) | BIT(7))
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +34 -1
@@ -70,6 +70,11 @@ enum mvpp2_bm_pool_log_num {module_param (queue_mode, int,0444 );MODULE_PARM_DESC (queue_mode,"Set queue_mode (single=0, multi=1)" ); +static int bm_underrun_protect =1 ; + +module_param (bm_underrun_protect, int,0444 ); +MODULE_PARM_DESC (bm_underrun_protect,"Set BM underrun protect feature (0-1), def=1" ); +/* Utility/helper methods */ void mvpp2_write (struct mvpp2 *priv,u32 offset,u32 data)
@@ -424,6 +429,21 @@ static int mvpp2_bm_pool_create(struct device *dev, struct mvpp2 *priv, val =mvpp2_read (priv,MVPP2_BM_POOL_CTRL_REG (bm_pool->id)); val |=MVPP2_BM_START_MASK ; + + val &= ~MVPP2_BM_LOW_THRESH_MASK ; + val &= ~MVPP2_BM_HIGH_THRESH_MASK ; + +/* Set 8 Pools BPPI threshold if BM underrun protection feature +* were enabled +*/ +if (priv->hw_version ==MVPP23 && bm_underrun_protect) { + val |=MVPP2_BM_LOW_THRESH_VALUE (MVPP23_BM_BPPI_LOW_THRESH ); + val |=MVPP2_BM_HIGH_THRESH_VALUE (MVPP23_BM_BPPI_HIGH_THRESH ); + }else { + val |=MVPP2_BM_LOW_THRESH_VALUE (MVPP2_BM_BPPI_LOW_THRESH ); + val |=MVPP2_BM_HIGH_THRESH_VALUE (MVPP2_BM_BPPI_HIGH_THRESH ); + } +mvpp2_write (priv,MVPP2_BM_POOL_CTRL_REG (bm_pool->id), val); bm_pool->size = size;
@@ -592,6 +612,16 @@ static int mvpp2_bm_pools_init(struct device *dev, struct mvpp2 *priv)return err; } +/* Routine enable PPv23 8 pool mode */ +static void mvpp23_bm_set_8pool_mode (struct mvpp2 *priv) +{ +int val; + + val =mvpp2_read (priv,MVPP22_BM_POOL_BASE_ADDR_HIGH_REG ); + val |=MVPP23_BM_8POOL_MODE ; +mvpp2_write (priv,MVPP22_BM_POOL_BASE_ADDR_HIGH_REG , val); +} +static int mvpp2_bm_init (struct device *dev,struct mvpp2 *priv) {enum dma_data_direction dma_dir =DMA_FROM_DEVICE ;
@@ -645,6 +675,9 @@ static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv)if (!priv->bm_pools)return -ENOMEM ; +if (priv->hw_version ==MVPP23 && bm_underrun_protect) +mvpp23_bm_set_8pool_mode (priv); + err =mvpp2_bm_pools_init (dev, priv);if (err <0 )return err;
@@ -6491,7 +6524,7 @@ static void mvpp2_mac_link_up(struct phylink_config *config, val); } -if (port->priv->global_tx_fc) { +if (port->priv->global_tx_fc && bm_underrun_protect) { port->tx_fc = tx_pause;if (tx_pause)mvpp2_rxq_enable_fc (port);
Signature · 1 line
1.9.1
PATCH v7 15/15 net: mvpp2: add TX FC firmware check
In reply to a message not in the archiveFrom: Stefan Chulski <[email protected]>
Patch check that TX FC firmware is running in CM3. If not, global TX FC would be disabled.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 42 ++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +1 -0
@@ -829,6 +829,7 @@#define MSS_THRESHOLD_STOP 768#define MSS_THRESHOLD_START 1024 +#define MSS_FC_MAX_TIMEOUT 5000/* RX buffer constants */ #define MVPP2_SKB_SHINFO_SIZE \
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +35 -7
61 lines not on this page · raw message
Signature · 1 line
1.9.1
Jakub Kicinski
maintainerRe: [PATCH v7 net-next 00/15] net: mvpp2: Add TX Flow Control support
In reply to a message not in the archiveQuoted 5 lines · On Sun, 31 Jan 2021 16:33:43 +0200 [email protected] wrote:
v6 --> v7
- Reduce patch set from 18 to 15 patches
- Documentation change combined into a single patch
- RXQ and BM size change combined into a single patch
- Ring size change check moved into "add RXQ flow control configurations" commit
It still did not get into patchwork :S
RE: [EXT] Re: [PATCH v7 net-next 00/15] net: mvpp2: Add TX Flow Control support
Quoted 9 lines · On Sun, 31 Jan 2021 16:33:43 +0200 [email protected] wrote:
Quoted 5 lines
v6 --> v7
- Reduce patch set from 18 to 15 patches
- Documentation change combined into a single patch
- RXQ and BM size change combined into a single patch
- Ring size change check moved into "add RXQ flow control configurations"commit
It still did not get into patchwork :S
Reposted:
https://patchwork.kernel.org/project/netdevbpf/list/?series=425967
Regards,
Stefan.