[PATCH net-next 0/3] net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

STALE1831d

8 messages, 3 authors, 2021-08-06 · open the first message on its own page

[PATCH net-next 0/3] net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-08-05 14:56:03

hi 

Now frame padding in TI TI CPSW/EMAC is implemented in a bit of entangled way as
frame SKB padded in drivers (without skb->len) while frame length fixed in CPDMA.
Things became even more confusing hence CPSW switcdev driver need to perform min
TX frame length correction in switch mode [1].

To avoid further confusion, make xmit path more clear and linear, and avoid
updating CPDMA configuration interface for min TX frame length correction
(which is not CPDMA job in general) this series switches TI CPSW/EMAC
drivers to skb_put_padto() instead of skb_padto() in their xmit path, so 
skb->len also got updated properly and then removes TX frame length
fixup from CPDMA code.

[1] https://patchwork.kernel.org/project/netdevbpf/patch/20210611132732.10690-1-grygorii.strashko@ti.com/

Grygorii Strashko (3):
  net: ethernet: ti: cpsw: switch to use skb_put_padto()
  net: ethernet: ti: davinci_emac: switch to use skb_put_padto()
  net: ethernet: ti: davinci_cpdma: drop frame padding

 drivers/net/ethernet/ti/cpsw.c          | 2 +-
 drivers/net/ethernet/ti/cpsw_priv.c     | 1 -
 drivers/net/ethernet/ti/davinci_cpdma.c | 5 -----
 drivers/net/ethernet/ti/davinci_cpdma.h | 1 -
 drivers/net/ethernet/ti/davinci_emac.c  | 3 +--
 5 files changed, 2 insertions(+), 10 deletions(-)

-- 
2.17.1

[PATCH net-next 1/3] net: ethernet: ti: cpsw: switch to use skb_put_padto()

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-08-05 14:56:07

Use skb_put_padto() instead of skb_padto() so skb->len also got updated, as
preparation for further removing frame padding from cpdma.
It also makes xmit path more clear and linear.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index abf9a2a6f7eb..8e1e582a10c8 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
 	struct cpdma_chan *txch;
 	int ret, q_idx;
 
-	if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) {
+	if (skb_put_padto(skb, CPSW_MIN_PACKET_SIZE)) {
 		cpsw_err(priv, tx_err, "packet pad failed\n");
 		ndev->stats.tx_dropped++;
 		return NET_XMIT_DROP;
-- 
2.17.1

[PATCH net-next 2/3] net: ethernet: ti: davinci_emac: switch to use skb_put_padto()

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-08-05 14:56:09

Use skb_put_padto() instead of skb_padto() so skb->len also got updated, as
preparation for further removing frame padding from cpdma.
It also makes xmit path more clear and linear.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/net/ethernet/ti/davinci_emac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 637796670746..b1c5cbe7478b 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -943,7 +943,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
 		goto fail_tx;
 	}
 
-	ret_code = skb_padto(skb, EMAC_DEF_MIN_ETHPKTSIZE);
+	ret_code = skb_put_padto(skb, EMAC_DEF_MIN_ETHPKTSIZE);
 	if (unlikely(ret_code < 0)) {
 		if (netif_msg_tx_err(priv) && net_ratelimit())
 			dev_err(emac_dev, "DaVinci EMAC: packet pad failed");
-- 
2.17.1

[PATCH net-next 3/3] net: ethernet: ti: davinci_cpdma: drop frame padding

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-08-05 14:56:11

Hence all users of davinci_cpdma switched to skb_put_padto() the frame
padding can be removed from it.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/net/ethernet/ti/cpsw_priv.c     | 1 -
 drivers/net/ethernet/ti/davinci_cpdma.c | 5 -----
 drivers/net/ethernet/ti/davinci_cpdma.h | 1 -
 drivers/net/ethernet/ti/davinci_emac.c  | 1 -
 4 files changed, 8 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
index ecc2a6b7e28f..d97a72c9ec53 100644
--- a/drivers/net/ethernet/ti/cpsw_priv.c
+++ b/drivers/net/ethernet/ti/cpsw_priv.c
@@ -518,7 +518,6 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs,
 
 	dma_params.num_chan		= data->channels;
 	dma_params.has_soft_reset	= true;
-	dma_params.min_packet_size	= CPSW_MIN_PACKET_SIZE;
 	dma_params.desc_mem_size	= data->bd_ram_size;
 	dma_params.desc_align		= 16;
 	dma_params.has_ext_regs		= true;
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index d2eab5cd1e0c..753d94c9915a 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -1034,11 +1034,6 @@ static int cpdma_chan_submit_si(struct submit_info *si)
 		return -ENOMEM;
 	}
 
-	if (len < ctlr->params.min_packet_size) {
-		len = ctlr->params.min_packet_size;
-		chan->stats.runt_transmit_buff++;
-	}
-
 	mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
 	cpdma_desc_to_port(chan, mode, si->directed);
 
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.h b/drivers/net/ethernet/ti/davinci_cpdma.h
index d3cfe234d16a..62151f13c7ce 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.h
+++ b/drivers/net/ethernet/ti/davinci_cpdma.h
@@ -26,7 +26,6 @@ struct cpdma_params {
 	void __iomem		*rxthresh, *rxfree;
 	int			num_chan;
 	bool			has_soft_reset;
-	int			min_packet_size;
 	dma_addr_t		desc_mem_phys;
 	dma_addr_t		desc_hw_addr;
 	int			desc_mem_size;
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index b1c5cbe7478b..cd2ef0282f38 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1850,7 +1850,6 @@ static int davinci_emac_probe(struct platform_device *pdev)
 	dma_params.txcp			= priv->emac_base + 0x640;
 	dma_params.rxcp			= priv->emac_base + 0x660;
 	dma_params.num_chan		= EMAC_MAX_TXRX_CHANNELS;
-	dma_params.min_packet_size	= EMAC_DEF_MIN_ETHPKTSIZE;
 	dma_params.desc_hw_addr		= hw_ram_addr;
 	dma_params.desc_mem_size	= pdata->ctrl_ram_size;
 	dma_params.desc_align		= 16;
-- 
2.17.1

Re: [PATCH net-next 0/3] net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-08-06 09:30:17

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu, 5 Aug 2021 17:55:52 +0300 you wrote:
hi

Now frame padding in TI TI CPSW/EMAC is implemented in a bit of entangled way as
frame SKB padded in drivers (without skb->len) while frame length fixed in CPDMA.
Things became even more confusing hence CPSW switcdev driver need to perform min
TX frame length correction in switch mode [1].

[...]
Here is the summary with links:
  - [net-next,1/3] net: ethernet: ti: cpsw: switch to use skb_put_padto()
    https://git.kernel.org/netdev/net-next/c/1f88d5d566b8
  - [net-next,2/3] net: ethernet: ti: davinci_emac: switch to use skb_put_padto()
    https://git.kernel.org/netdev/net-next/c/61e7a22da75b
  - [net-next,3/3] net: ethernet: ti: davinci_cpdma: drop frame padding
    https://git.kernel.org/netdev/net-next/c/9ffc513f95ee

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Re: [PATCH net-next 0/3] net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-08-06 10:00:48

hi Jakub, David,

On 06/08/2021 12:30, patchwork-bot+netdevbpf@kernel.org wrote:
Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu, 5 Aug 2021 17:55:52 +0300 you wrote:
quoted
hi

Now frame padding in TI TI CPSW/EMAC is implemented in a bit of entangled way as
frame SKB padded in drivers (without skb->len) while frame length fixed in CPDMA.
Things became even more confusing hence CPSW switcdev driver need to perform min
TX frame length correction in switch mode [1].

[...]
Here is the summary with links:
   - [net-next,1/3] net: ethernet: ti: cpsw: switch to use skb_put_padto()
     https://git.kernel.org/netdev/net-next/c/1f88d5d566b8
   - [net-next,2/3] net: ethernet: ti: davinci_emac: switch to use skb_put_padto()
     https://git.kernel.org/netdev/net-next/c/61e7a22da75b
   - [net-next,3/3] net: ethernet: ti: davinci_cpdma: drop frame padding
     https://git.kernel.org/netdev/net-next/c/9ffc513f95ee
I'm terribly sorry for the mess here - this series depends from patch
"net: ethernet: ti: cpsw: fix min eth packet size for non-switch use-cases" [1]

Not sure what I've being thinking about I've had to note it or include in this series :(

I'm very sorry again - can it be dropped?

[1] https://patchwork.kernel.org/project/netdevbpf/patch/20210805145511.12016-1-grygorii.strashko@ti.com/

-- 
Best regards,
grygorii

Re: [PATCH net-next 0/3] net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

From: David Miller <davem@davemloft.net>
Date: 2021-08-06 10:04:55

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: Fri, 6 Aug 2021 13:00:30 +0300
I'm very sorry again - can it be dropped?
Easiest is for you to send a fixup or a revert to the list, thanks.

Re: [PATCH net-next 0/3] net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: 2021-08-06 10:07:21


On 06/08/2021 13:04, David Miller wrote:
From: Grygorii Strashko <grygorii.strashko@ti.com>
Date: Fri, 6 Aug 2021 13:00:30 +0300
quoted
I'm very sorry again - can it be dropped?
Easiest is for you to send a fixup or a revert to the list, thanks.
Only Patch 3 need to be reverted - i'll send revert. Thank you.

-- 
Best regards,
grygorii
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help