diff options
author | Bogdan Purcareata <bogdan.purcareata@freescale.com> | 2013-10-07 14:29:24 (GMT) |
---|---|---|
committer | J. German Rivera <German.Rivera@freescale.com> | 2013-10-21 19:04:49 (GMT) |
commit | c0e2e95af2c30aaf2161633623d3f32f91403071 (patch) | |
tree | 3368c4ddd1a9486f39099a1436f22671088ae708 /drivers/net/ethernet/freescale/dpa | |
parent | 32e02ef5cb236adec018d5213794087a114bed4c (diff) | |
download | linux-fsl-qoriq-c0e2e95af2c30aaf2161633623d3f32f91403071.tar.xz |
dpaa_eth: TX csum computation refactoring
Automatically set DTC bit in fd.cmd for all traffic originating
from macless interfaces. Update dpa_shared_tx code to bypass
calling dpa_enable_tx_csum when priv->mac_dev == NULL.
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
Change-Id: I66c6662559c3c560cba1b55ab082f8390a30988d
Reviewed-on: http://git.am.freescale.net:8181/5205
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com>
Reviewed-by: Rivera Jose-B46482 <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa')
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c | 46 |
2 files changed, 36 insertions, 12 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c index 7821195..c599052 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c @@ -1530,7 +1530,7 @@ int dpa_enable_tx_csum(struct dpa_priv_s *priv, int ethertype = ntohs(skb->protocol); int retval = 0; - if (!priv->mac_dev || skb->ip_summed != CHECKSUM_PARTIAL) + if (skb->ip_summed != CHECKSUM_PARTIAL) return 0; /* Note: L3 csum seems to be already computed in sw, but we can't choose diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c index 300c456..64857e5 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_shared.c @@ -498,12 +498,43 @@ int __hot dpa_shared_tx(struct sk_buff *skb, struct net_device *net_dev) dpa_bp_vaddr + dpa_fd_offset(&fd), dpa_fd_length(&fd)); - /* Enable L3/L4 hardware checksum computation, if applicable */ - err = dpa_enable_tx_csum(priv, skb, &fd, + if (!priv->mac_dev) + fd.cmd |= FM_FD_CMD_DTC; + else { + /* Enable L3/L4 hardware checksum computation, + * if applicable + */ + err = dpa_enable_tx_csum(priv, skb, &fd, dpa_bp_vaddr + DPA_TX_PRIV_DATA_SIZE); + + if (unlikely(err < 0)) { + if (netif_msg_tx_err(priv) && net_ratelimit()) + netdev_err(net_dev, + "Tx HW csum error: %d\n", err); + percpu_priv->stats.tx_errors++; + goto l3_l4_csum_failed; + } + } + } else { - err = dpa_enable_tx_csum(priv, skb, &fd, - (char *)&parse_results); + if (!priv->mac_dev) + fd.cmd |= FM_FD_CMD_DTC; + else { + /* Enable L3/L4 hardware checksum computation, + * if applicable + */ + err = dpa_enable_tx_csum(priv, skb, &fd, + (char *)&parse_results); + + if (unlikely(err < 0)) { + if (netif_msg_tx_err(priv) && net_ratelimit()) + netdev_err(net_dev, + "Tx HW csum error: %d\n", err); + percpu_priv->stats.tx_errors++; + goto l3_l4_csum_failed; + } + + } copy_to_unmapped_area(bm_buf_addr(&bmb) + DPA_TX_PRIV_DATA_SIZE, &parse_results, @@ -514,13 +545,6 @@ int __hot dpa_shared_tx(struct sk_buff *skb, struct net_device *net_dev) dpa_fd_length(&fd)); } - if (unlikely(err < 0)) { - if (netif_msg_tx_err(priv) && net_ratelimit()) - netdev_err(net_dev, "Tx HW csum error: %d\n", err); - percpu_priv->stats.tx_errors++; - goto l3_l4_csum_failed; - } - err = dpa_xmit(priv, &percpu_priv->stats, queue_mapping, &fd); l3_l4_csum_failed: |