diff options
author | Ioana Radulescu <ruxandra.radulescu@freescale.com> | 2013-07-18 14:47:27 (GMT) |
---|---|---|
committer | Fleming Andrew-AFLEMING <AFLEMING@freescale.com> | 2013-07-30 20:50:04 (GMT) |
commit | d90ed17cd894d4bc171f44567da4e480450cd0b5 (patch) | |
tree | 9256411b3e9bbfa94a2c88cf2018afc058875aa5 /drivers/net/ethernet/freescale/dpa | |
parent | c534d862cf781e277333886b7ce677c30affc2a4 (diff) | |
download | linux-fsl-qoriq-d90ed17cd894d4bc171f44567da4e480450cd0b5.tar.xz |
dpaa_eth: Fix computation of FD headroom
The Rx/Tx headrooms are aligned to a configurable value; if that value is
zero however, FMD will interpret it as a "don't care" and use its own
internal default, which is currently 64.
If the user configures a zero headroom alignment, use our own default,
otherwise we risk getting out of sync with the actual hardware configuration.
Also, don't assume the Rx headroom is always equal to the Tx headroom plus
the Kconfigurable Rx extra headroom, since alignment may change this.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@freescale.com>
Change-Id: Iaf12deb55f4330edb46c6d358114f8f757b64f08
Reviewed-on: http://git.am.freescale.net:8181/3479
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Hamciuc Bogdan-BHAMCIU1 <bogdan.hamciuc@freescale.com>
Reviewed-by: Bucur Madalin-Cristian-B32716 <madalin.bucur@freescale.com>
Reviewed-by: Sovaiala Cristian-Constantin-B39531 <Cristian.Sovaiala@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Diffstat (limited to 'drivers/net/ethernet/freescale/dpa')
4 files changed, 13 insertions, 7 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c index d09d6b9..1c6bc39 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.c @@ -750,8 +750,8 @@ dpaa_eth_priv_probe(struct platform_device *_of_dev) } priv->buf_layout = buf_layout; - priv->tx_headroom = - dpa_get_headroom(&priv->buf_layout[TX]); + priv->tx_headroom = dpa_get_headroom(&priv->buf_layout[TX]); + priv->rx_headroom = dpa_get_headroom(&priv->buf_layout[RX]); /* All real interfaces need their ports initialized */ dpaa_eth_init_ports(mac_dev, dpa_bp, count, &port_fqs, diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpa/dpaa_eth.h index 68c1994..31f7052 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.h @@ -222,6 +222,9 @@ void fsl_dpaa_eth_set_hooks(struct dpaa_eth_hooks_s *hooks); /* Maximum offset value for a contig or sg FD (represented on 9 bits) */ #define DPA_MAX_FD_OFFSET ((1 << 9) - 1) +/* Default alignment for start of data in an Rx FD */ +#define DPA_FD_DATA_ALIGNMENT 16 + /* * Values for the L3R field of the FM Parse Results */ @@ -465,6 +468,7 @@ struct dpa_priv_s { struct dpa_buffer_layout_s *buf_layout; u8 macless_idx; + uint16_t rx_headroom; }; struct fm_port_fqs { diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c index 68e92db..96b8290 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_common.c @@ -663,7 +663,10 @@ void dpa_set_buffers_layout(struct mac_device *mac_dev, #endif fm_port_get_buff_layout_ext_params(mac_dev->port_dev[RX], ¶ms); layout[RX].manip_extra_space = params.manip_extra_space; - layout[RX].data_align = params.data_align; + /* a value of zero for data alignment means "don't care", so align to + * a non-zero value to prevent FMD from using its own default + */ + layout[RX].data_align = params.data_align ? : DPA_FD_DATA_ALIGNMENT; /* Tx */ layout[TX].priv_data_size = DPA_TX_PRIV_DATA_SIZE; @@ -674,7 +677,7 @@ void dpa_set_buffers_layout(struct mac_device *mac_dev, #endif fm_port_get_buff_layout_ext_params(mac_dev->port_dev[TX], ¶ms); layout[TX].manip_extra_space = params.manip_extra_space; - layout[TX].data_align = params.data_align; + layout[RX].data_align = params.data_align ? : DPA_FD_DATA_ALIGNMENT; } static int dpa_bp_cmp(const void *dpa_bp0, const void *dpa_bp1) diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c index 1d4f3ca..d5b52e1 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sg.c @@ -364,7 +364,7 @@ static struct sk_buff *__hot contig_fd_to_skb(const struct dpa_priv_s *priv, if (unlikely(!skb)) return NULL; - BUG_ON(fd_off != priv->tx_headroom + dpa_get_rx_extra_headroom()); + BUG_ON(fd_off != priv->rx_headroom); skb_reserve(skb, fd_off); skb_put(skb, dpa_fd_length(fd)); @@ -464,8 +464,7 @@ static struct sk_buff *__hot sg_fd_to_skb(const struct dpa_priv_s *priv, /* Make sure forwarded skbs will have enough space * on Tx, if extra headers are added. */ - BUG_ON(fd_off != priv->tx_headroom + - dpa_get_rx_extra_headroom()); + BUG_ON(fd_off != priv->rx_headroom); skb_reserve(skb, fd_off); skb_put(skb, sgt[i].length); } else { |