Commit a5516053 authored by David S. Miller's avatar David S. Miller

Merge branch 'cpsw-emac-skb_put_padto'

Grygorii Strashko says:

====================
net: ethernet: ti: cpsw/emac: switch to use skb_put_padto()

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/
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0ca8d3ca 9ffc513f
...@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, ...@@ -905,7 +905,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb,
struct cpdma_chan *txch; struct cpdma_chan *txch;
int ret, q_idx; 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"); cpsw_err(priv, tx_err, "packet pad failed\n");
ndev->stats.tx_dropped++; ndev->stats.tx_dropped++;
return NET_XMIT_DROP; return NET_XMIT_DROP;
......
...@@ -518,7 +518,6 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, ...@@ -518,7 +518,6 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs,
dma_params.num_chan = data->channels; dma_params.num_chan = data->channels;
dma_params.has_soft_reset = true; 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_mem_size = data->bd_ram_size;
dma_params.desc_align = 16; dma_params.desc_align = 16;
dma_params.has_ext_regs = true; dma_params.has_ext_regs = true;
......
...@@ -1034,11 +1034,6 @@ static int cpdma_chan_submit_si(struct submit_info *si) ...@@ -1034,11 +1034,6 @@ static int cpdma_chan_submit_si(struct submit_info *si)
return -ENOMEM; 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; mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP;
cpdma_desc_to_port(chan, mode, si->directed); cpdma_desc_to_port(chan, mode, si->directed);
......
...@@ -26,7 +26,6 @@ struct cpdma_params { ...@@ -26,7 +26,6 @@ struct cpdma_params {
void __iomem *rxthresh, *rxfree; void __iomem *rxthresh, *rxfree;
int num_chan; int num_chan;
bool has_soft_reset; bool has_soft_reset;
int min_packet_size;
dma_addr_t desc_mem_phys; dma_addr_t desc_mem_phys;
dma_addr_t desc_hw_addr; dma_addr_t desc_hw_addr;
int desc_mem_size; int desc_mem_size;
......
...@@ -943,7 +943,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -943,7 +943,7 @@ static int emac_dev_xmit(struct sk_buff *skb, struct net_device *ndev)
goto fail_tx; 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 (unlikely(ret_code < 0)) {
if (netif_msg_tx_err(priv) && net_ratelimit()) if (netif_msg_tx_err(priv) && net_ratelimit())
dev_err(emac_dev, "DaVinci EMAC: packet pad failed"); dev_err(emac_dev, "DaVinci EMAC: packet pad failed");
...@@ -1850,7 +1850,6 @@ static int davinci_emac_probe(struct platform_device *pdev) ...@@ -1850,7 +1850,6 @@ static int davinci_emac_probe(struct platform_device *pdev)
dma_params.txcp = priv->emac_base + 0x640; dma_params.txcp = priv->emac_base + 0x640;
dma_params.rxcp = priv->emac_base + 0x660; dma_params.rxcp = priv->emac_base + 0x660;
dma_params.num_chan = EMAC_MAX_TXRX_CHANNELS; 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_hw_addr = hw_ram_addr;
dma_params.desc_mem_size = pdata->ctrl_ram_size; dma_params.desc_mem_size = pdata->ctrl_ram_size;
dma_params.desc_align = 16; dma_params.desc_align = 16;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment