* [PATCH net v2 0/3] net: mvpp2: various fixes
@ 2017-09-25 12:59 Antoine Tenart
2017-09-25 12:59 ` [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection Antoine Tenart
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-09-25 12:59 UTC (permalink / raw)
To: davem
Cc: Antoine Tenart, andrew, gregory.clement, thomas.petazzoni,
miquel.raynal, nadavh, linux, linux-kernel, mw, stefanc, netdev
Hi all,
This series contains 3 fixes for the Marvell PPv2 driver.
Thanks!
Antoine
Since v1:
- Removed one patch about dma masks as it would need a better fix.
- Added one fix about the MAC Tx clock source selection.
Antoine Tenart (1):
net: mvpp2: do not select the internal source clock
Stefan Chulski (1):
net: mvpp2: fix parsing fragmentation detection
Yan Markman (1):
net: mvpp2: fix port list indexing
drivers/net/ethernet/marvell/mvpp2.c | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
--
2.13.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection 2017-09-25 12:59 [PATCH net v2 0/3] net: mvpp2: various fixes Antoine Tenart @ 2017-09-25 12:59 ` Antoine Tenart 2017-09-25 13:10 ` Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 2/3] net: mvpp2: fix port list indexing Antoine Tenart ` (2 subsequent siblings) 3 siblings, 1 reply; 7+ messages in thread From: Antoine Tenart @ 2017-09-25 12:59 UTC (permalink / raw) To: davem Cc: Stefan Chulski, andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, linux, linux-kernel, mw, netdev, Antoine Tenart From: Stefan Chulski <stefanc@marvell.com> Parsing fragmentation detection failed due to wrong configured parser TCAM entry's. Some traffic was marked as fragmented in RX descriptor, even it wasn't IP fragmented. The hardware also failed to calculate checksums which lead to use software checksum and caused performance degradation. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> --- drivers/net/ethernet/marvell/mvpp2.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index dd0ee2691c86..da04939a2748 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -676,6 +676,7 @@ enum mvpp2_tag_type { #define MVPP2_PRS_RI_L3_MCAST BIT(15) #define MVPP2_PRS_RI_L3_BCAST (BIT(15) | BIT(16)) #define MVPP2_PRS_RI_IP_FRAG_MASK 0x20000 +#define MVPP2_PRS_RI_IP_FRAG_TRUE BIT(17) #define MVPP2_PRS_RI_UDF3_MASK 0x300000 #define MVPP2_PRS_RI_UDF3_RX_SPECIAL BIT(21) #define MVPP2_PRS_RI_L4_PROTO_MASK 0x1c00000 @@ -2315,7 +2316,7 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, (proto != IPPROTO_IGMP)) return -EINVAL; - /* Fragmented packet */ + /* Not fragmented packet */ tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID, MVPP2_PE_LAST_FREE_TID); if (tid < 0) @@ -2334,8 +2335,12 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, MVPP2_PRS_SRAM_OP_SEL_UDF_ADD); mvpp2_prs_sram_ai_update(&pe, MVPP2_PRS_IPV4_DIP_AI_BIT, MVPP2_PRS_IPV4_DIP_AI_BIT); - mvpp2_prs_sram_ri_update(&pe, ri | MVPP2_PRS_RI_IP_FRAG_MASK, - ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK); + mvpp2_prs_sram_ri_update(&pe, ri, ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK); + + mvpp2_prs_tcam_data_byte_set(&pe, 2, 0x00, + MVPP2_PRS_TCAM_PROTO_MASK_L); + mvpp2_prs_tcam_data_byte_set(&pe, 3, 0x00, + MVPP2_PRS_TCAM_PROTO_MASK); mvpp2_prs_tcam_data_byte_set(&pe, 5, proto, MVPP2_PRS_TCAM_PROTO_MASK); mvpp2_prs_tcam_ai_update(&pe, 0, MVPP2_PRS_IPV4_DIP_AI_BIT); @@ -2346,7 +2351,7 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, mvpp2_prs_shadow_set(priv, pe.index, MVPP2_PRS_LU_IP4); mvpp2_prs_hw_write(priv, &pe); - /* Not fragmented packet */ + /* Fragmented packet */ tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID, MVPP2_PE_LAST_FREE_TID); if (tid < 0) @@ -2358,8 +2363,11 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, pe.sram.word[MVPP2_PRS_SRAM_RI_CTRL_WORD] = 0x0; mvpp2_prs_sram_ri_update(&pe, ri, ri_mask); - mvpp2_prs_tcam_data_byte_set(&pe, 2, 0x00, MVPP2_PRS_TCAM_PROTO_MASK_L); - mvpp2_prs_tcam_data_byte_set(&pe, 3, 0x00, MVPP2_PRS_TCAM_PROTO_MASK); + mvpp2_prs_sram_ri_update(&pe, ri | MVPP2_PRS_RI_IP_FRAG_TRUE, + ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK); + + mvpp2_prs_tcam_data_byte_set(&pe, 2, 0x00, 0x0); + mvpp2_prs_tcam_data_byte_set(&pe, 3, 0x00, 0x0); /* Update shadow table and hw entry */ mvpp2_prs_shadow_set(priv, pe.index, MVPP2_PRS_LU_IP4); -- 2.13.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection 2017-09-25 12:59 ` [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection Antoine Tenart @ 2017-09-25 13:10 ` Antoine Tenart 0 siblings, 0 replies; 7+ messages in thread From: Antoine Tenart @ 2017-09-25 13:10 UTC (permalink / raw) To: davem Cc: Stefan Chulski, andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, linux, linux-kernel, mw, netdev, Antoine Tenart On Mon, Sep 25, 2017 at 02:59:46PM +0200, Antoine Tenart wrote: > From: Stefan Chulski <stefanc@marvell.com> > > Parsing fragmentation detection failed due to wrong configured > parser TCAM entry's. Some traffic was marked as fragmented in RX > descriptor, even it wasn't IP fragmented. The hardware also failed to > calculate checksums which lead to use software checksum and caused > performance degradation. > > Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") With, Signed-off-by: Stefan Chulski <stefanc@marvell.com> I don't know why this SoB was removed but it should be added back. Antoine > Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> > --- > drivers/net/ethernet/marvell/mvpp2.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c > index dd0ee2691c86..da04939a2748 100644 > --- a/drivers/net/ethernet/marvell/mvpp2.c > +++ b/drivers/net/ethernet/marvell/mvpp2.c > @@ -676,6 +676,7 @@ enum mvpp2_tag_type { > #define MVPP2_PRS_RI_L3_MCAST BIT(15) > #define MVPP2_PRS_RI_L3_BCAST (BIT(15) | BIT(16)) > #define MVPP2_PRS_RI_IP_FRAG_MASK 0x20000 > +#define MVPP2_PRS_RI_IP_FRAG_TRUE BIT(17) > #define MVPP2_PRS_RI_UDF3_MASK 0x300000 > #define MVPP2_PRS_RI_UDF3_RX_SPECIAL BIT(21) > #define MVPP2_PRS_RI_L4_PROTO_MASK 0x1c00000 > @@ -2315,7 +2316,7 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, > (proto != IPPROTO_IGMP)) > return -EINVAL; > > - /* Fragmented packet */ > + /* Not fragmented packet */ > tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID, > MVPP2_PE_LAST_FREE_TID); > if (tid < 0) > @@ -2334,8 +2335,12 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, > MVPP2_PRS_SRAM_OP_SEL_UDF_ADD); > mvpp2_prs_sram_ai_update(&pe, MVPP2_PRS_IPV4_DIP_AI_BIT, > MVPP2_PRS_IPV4_DIP_AI_BIT); > - mvpp2_prs_sram_ri_update(&pe, ri | MVPP2_PRS_RI_IP_FRAG_MASK, > - ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK); > + mvpp2_prs_sram_ri_update(&pe, ri, ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK); > + > + mvpp2_prs_tcam_data_byte_set(&pe, 2, 0x00, > + MVPP2_PRS_TCAM_PROTO_MASK_L); > + mvpp2_prs_tcam_data_byte_set(&pe, 3, 0x00, > + MVPP2_PRS_TCAM_PROTO_MASK); > > mvpp2_prs_tcam_data_byte_set(&pe, 5, proto, MVPP2_PRS_TCAM_PROTO_MASK); > mvpp2_prs_tcam_ai_update(&pe, 0, MVPP2_PRS_IPV4_DIP_AI_BIT); > @@ -2346,7 +2351,7 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, > mvpp2_prs_shadow_set(priv, pe.index, MVPP2_PRS_LU_IP4); > mvpp2_prs_hw_write(priv, &pe); > > - /* Not fragmented packet */ > + /* Fragmented packet */ > tid = mvpp2_prs_tcam_first_free(priv, MVPP2_PE_FIRST_FREE_TID, > MVPP2_PE_LAST_FREE_TID); > if (tid < 0) > @@ -2358,8 +2363,11 @@ static int mvpp2_prs_ip4_proto(struct mvpp2 *priv, unsigned short proto, > pe.sram.word[MVPP2_PRS_SRAM_RI_CTRL_WORD] = 0x0; > mvpp2_prs_sram_ri_update(&pe, ri, ri_mask); > > - mvpp2_prs_tcam_data_byte_set(&pe, 2, 0x00, MVPP2_PRS_TCAM_PROTO_MASK_L); > - mvpp2_prs_tcam_data_byte_set(&pe, 3, 0x00, MVPP2_PRS_TCAM_PROTO_MASK); > + mvpp2_prs_sram_ri_update(&pe, ri | MVPP2_PRS_RI_IP_FRAG_TRUE, > + ri_mask | MVPP2_PRS_RI_IP_FRAG_MASK); > + > + mvpp2_prs_tcam_data_byte_set(&pe, 2, 0x00, 0x0); > + mvpp2_prs_tcam_data_byte_set(&pe, 3, 0x00, 0x0); > > /* Update shadow table and hw entry */ > mvpp2_prs_shadow_set(priv, pe.index, MVPP2_PRS_LU_IP4); > -- > 2.13.5 > -- Antoine Ténart, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net v2 2/3] net: mvpp2: fix port list indexing 2017-09-25 12:59 [PATCH net v2 0/3] net: mvpp2: various fixes Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection Antoine Tenart @ 2017-09-25 12:59 ` Antoine Tenart 2017-09-25 13:09 ` Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 3/3] net: mvpp2: do not select the internal source clock Antoine Tenart 2017-09-28 16:34 ` [PATCH net v2 0/3] net: mvpp2: various fixes David Miller 3 siblings, 1 reply; 7+ messages in thread From: Antoine Tenart @ 2017-09-25 12:59 UTC (permalink / raw) To: davem Cc: Yan Markman, andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, linux, linux-kernel, mw, stefanc, netdev, Antoine Tenart From: Yan Markman <ymarkman@marvell.com> The private port_list array has a list of pointers to mvpp2_port instances. This list is allocated given the number of ports enabled in the device tree, but the pointers are set using the port-id property. If on a single port is enabled, the port_list array will be of size 1, but when registering the port, if its id is not 0 the driver will crash. Other crashes were encountered in various situations. This fixes the issue by using an index not equal to the value of the port-id property. Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> --- drivers/net/ethernet/marvell/mvpp2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index da04939a2748..b2f99df81e9c 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -7504,7 +7504,7 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv, /* Ports initialization */ static int mvpp2_port_probe(struct platform_device *pdev, struct device_node *port_node, - struct mvpp2 *priv) + struct mvpp2 *priv, int index) { struct device_node *phy_node; struct phy *comphy; @@ -7678,7 +7678,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, } netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr); - priv->port_list[id] = port; + priv->port_list[index] = port; return 0; err_free_port_pcpu: @@ -8013,10 +8013,12 @@ static int mvpp2_probe(struct platform_device *pdev) } /* Initialize ports */ + i = 0; for_each_available_child_of_node(dn, port_node) { - err = mvpp2_port_probe(pdev, port_node, priv); + err = mvpp2_port_probe(pdev, port_node, priv, i); if (err < 0) goto err_mg_clk; + i++; } platform_set_drvdata(pdev, priv); -- 2.13.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 2/3] net: mvpp2: fix port list indexing 2017-09-25 12:59 ` [PATCH net v2 2/3] net: mvpp2: fix port list indexing Antoine Tenart @ 2017-09-25 13:09 ` Antoine Tenart 0 siblings, 0 replies; 7+ messages in thread From: Antoine Tenart @ 2017-09-25 13:09 UTC (permalink / raw) To: davem Cc: Yan Markman, andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, linux, linux-kernel, mw, stefanc, netdev, Antoine Tenart On Mon, Sep 25, 2017 at 02:59:47PM +0200, Antoine Tenart wrote: > From: Yan Markman <ymarkman@marvell.com> > > The private port_list array has a list of pointers to mvpp2_port > instances. This list is allocated given the number of ports enabled in > the device tree, but the pointers are set using the port-id property. If > on a single port is enabled, the port_list array will be of size 1, but > when registering the port, if its id is not 0 the driver will crash. > Other crashes were encountered in various situations. > > This fixes the issue by using an index not equal to the value of the > port-id property. > > Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") With, Signed-off-by: Yan Markman <ymarkman@marvell.com> I don't know why it was removed, but this SoB should be added back. Antoine > Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> > --- > drivers/net/ethernet/marvell/mvpp2.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c > index da04939a2748..b2f99df81e9c 100644 > --- a/drivers/net/ethernet/marvell/mvpp2.c > +++ b/drivers/net/ethernet/marvell/mvpp2.c > @@ -7504,7 +7504,7 @@ static void mvpp2_port_copy_mac_addr(struct net_device *dev, struct mvpp2 *priv, > /* Ports initialization */ > static int mvpp2_port_probe(struct platform_device *pdev, > struct device_node *port_node, > - struct mvpp2 *priv) > + struct mvpp2 *priv, int index) > { > struct device_node *phy_node; > struct phy *comphy; > @@ -7678,7 +7678,7 @@ static int mvpp2_port_probe(struct platform_device *pdev, > } > netdev_info(dev, "Using %s mac address %pM\n", mac_from, dev->dev_addr); > > - priv->port_list[id] = port; > + priv->port_list[index] = port; > return 0; > > err_free_port_pcpu: > @@ -8013,10 +8013,12 @@ static int mvpp2_probe(struct platform_device *pdev) > } > > /* Initialize ports */ > + i = 0; > for_each_available_child_of_node(dn, port_node) { > - err = mvpp2_port_probe(pdev, port_node, priv); > + err = mvpp2_port_probe(pdev, port_node, priv, i); > if (err < 0) > goto err_mg_clk; > + i++; > } > > platform_set_drvdata(pdev, priv); > -- > 2.13.5 > -- Antoine Ténart, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net v2 3/3] net: mvpp2: do not select the internal source clock 2017-09-25 12:59 [PATCH net v2 0/3] net: mvpp2: various fixes Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 2/3] net: mvpp2: fix port list indexing Antoine Tenart @ 2017-09-25 12:59 ` Antoine Tenart 2017-09-28 16:34 ` [PATCH net v2 0/3] net: mvpp2: various fixes David Miller 3 siblings, 0 replies; 7+ messages in thread From: Antoine Tenart @ 2017-09-25 12:59 UTC (permalink / raw) To: davem Cc: Antoine Tenart, andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, linux, linux-kernel, mw, stefanc, netdev This patch stops the internal MAC Tx clock from being enabled as the internal clock isn't used. The definition used for the bit controlling this behaviour is renamed as well as it was wrongly named (bit 4 of GMAC_CTRL_2_REG). Fixes: 3919357fb0bb ("net: mvpp2: initialize the GMAC when using a port") Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> --- drivers/net/ethernet/marvell/mvpp2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index b2f99df81e9c..161055564720 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -333,7 +333,7 @@ #define MVPP2_GMAC_INBAND_AN_MASK BIT(0) #define MVPP2_GMAC_FLOW_CTRL_MASK GENMASK(2, 1) #define MVPP2_GMAC_PCS_ENABLE_MASK BIT(3) -#define MVPP2_GMAC_PORT_RGMII_MASK BIT(4) +#define MVPP2_GMAC_INTERNAL_CLK_MASK BIT(4) #define MVPP2_GMAC_DISABLE_PADDING BIT(5) #define MVPP2_GMAC_PORT_RESET_MASK BIT(6) #define MVPP2_GMAC_AUTONEG_CONFIG 0xc @@ -4599,7 +4599,6 @@ static void mvpp2_port_mii_gmac_configure(struct mvpp2_port *port) val |= MVPP2_GMAC_INBAND_AN_MASK | MVPP2_GMAC_PCS_ENABLE_MASK; } else if (phy_interface_mode_is_rgmii(port->phy_interface)) { val &= ~MVPP2_GMAC_PCS_ENABLE_MASK; - val |= MVPP2_GMAC_PORT_RGMII_MASK; } writel(val, port->base + MVPP2_GMAC_CTRL_2_REG); -- 2.13.5 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 0/3] net: mvpp2: various fixes 2017-09-25 12:59 [PATCH net v2 0/3] net: mvpp2: various fixes Antoine Tenart ` (2 preceding siblings ...) 2017-09-25 12:59 ` [PATCH net v2 3/3] net: mvpp2: do not select the internal source clock Antoine Tenart @ 2017-09-28 16:34 ` David Miller 3 siblings, 0 replies; 7+ messages in thread From: David Miller @ 2017-09-28 16:34 UTC (permalink / raw) To: antoine.tenart Cc: andrew, gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, linux, linux-kernel, mw, stefanc, netdev From: Antoine Tenart <antoine.tenart@free-electrons.com> Date: Mon, 25 Sep 2017 14:59:45 +0200 > This series contains 3 fixes for the Marvell PPv2 driver. Series applied, thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-09-28 16:34 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-09-25 12:59 [PATCH net v2 0/3] net: mvpp2: various fixes Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 1/3] net: mvpp2: fix parsing fragmentation detection Antoine Tenart 2017-09-25 13:10 ` Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 2/3] net: mvpp2: fix port list indexing Antoine Tenart 2017-09-25 13:09 ` Antoine Tenart 2017-09-25 12:59 ` [PATCH net v2 3/3] net: mvpp2: do not select the internal source clock Antoine Tenart 2017-09-28 16:34 ` [PATCH net v2 0/3] net: mvpp2: various fixes David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).