Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iMX28 Ethernet driver fix
@ 2011-11-08 11:17 Peter Horton
  2011-11-08 12:01 ` Baruch Siach
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Horton @ 2011-11-08 11:17 UTC (permalink / raw)
  To: linux-arm-kernel

Fix driver to correctly handle cloned SKBs. Currently any clones
of the transmit SKBs get endian-swapped by the driver. This breaks
the ATA-over-Ethernet driver for example.

Signed-off-by: Peter Horton <phorton@bitbox.co.uk>
---
 drivers/net/fec.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index c46ccb1..6455483 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -302,8 +302,14 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	 * On some FEC implementations data must be aligned on
 	 * 4-byte boundaries. Use bounce buffers to copy data
 	 * and get it aligned. Ugh.
+	 *
+	 * We also have to use the bounce buffers if we need
+	 * to do the endian swap (see below) on a cloned buffer.
 	 */
-	if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
+	if ((((unsigned long) bufaddr) & FEC_ALIGNMENT) ||
+		((id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) &&
+		skb_cloned(skb)))
+	{
 		unsigned int index;
 		index = bdp - fep->tx_bd_base;
 		memcpy(fep->tx_bounce[index], skb->data, skb->len);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] iMX28 Ethernet driver fix
  2011-11-08 11:17 [PATCH] iMX28 Ethernet driver fix Peter Horton
@ 2011-11-08 12:01 ` Baruch Siach
  0 siblings, 0 replies; 4+ messages in thread
From: Baruch Siach @ 2011-11-08 12:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Peter,

On Tue, Nov 08, 2011 at 11:17:49AM +0000, Peter Horton wrote:
> Fix driver to correctly handle cloned SKBs. Currently any clones
> of the transmit SKBs get endian-swapped by the driver. This breaks
> the ATA-over-Ethernet driver for example.

Patches for network devices should go to the netdev list.

> Signed-off-by: Peter Horton <phorton@bitbox.co.uk>
> ---
>  drivers/net/fec.c |    8 +++++++-

The driver has moved to drivers/net/ethernet/freescale/fec.c. You should 
rebase on v3.2-rc1.

>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index c46ccb1..6455483 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -302,8 +302,14 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
>  	 * On some FEC implementations data must be aligned on
>  	 * 4-byte boundaries. Use bounce buffers to copy data
>  	 * and get it aligned. Ugh.
> +	 *
> +	 * We also have to use the bounce buffers if we need
> +	 * to do the endian swap (see below) on a cloned buffer.
>  	 */
> -	if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
> +	if ((((unsigned long) bufaddr) & FEC_ALIGNMENT) ||
> +		((id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) &&
> +		skb_cloned(skb)))
> +	{
>  		unsigned int index;
>  		index = bdp - fep->tx_bd_base;
>  		memcpy(fep->tx_bounce[index], skb->data, skb->len);
> -- 

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] iMX28 Ethernet driver fix
@ 2011-11-09 12:44 Peter Horton
  2011-11-09 21:11 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Horton @ 2011-11-09 12:44 UTC (permalink / raw)
  To: linux-arm-kernel

Fix driver to correctly handle cloned SKBs. Currently any clones
of the transmit SKBs get endian-swapped by the driver. This breaks
the ATA-over-Ethernet driver for example.

Signed-off-by: Peter Horton <phorton@bitbox.co.uk>
---
 drivers/net/ethernet/freescale/fec.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 1124ce0..aff1fa9 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -312,8 +312,14 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	 * On some FEC implementations data must be aligned on
 	 * 4-byte boundaries. Use bounce buffers to copy data
 	 * and get it aligned. Ugh.
+	 *
+	 * We also have to use the bounce buffers if we need
+	 * to do the endian swap (see below) on a cloned buffer.
 	 */
-	if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
+	if ((((unsigned long) bufaddr) & FEC_ALIGNMENT) ||
+		((id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) &&
+		skb_cloned(skb)))
+	{
 		unsigned int index;
 		index = bdp - fep->tx_bd_base;
 		memcpy(fep->tx_bounce[index], skb->data, skb->len);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] iMX28 Ethernet driver fix
  2011-11-09 12:44 Peter Horton
@ 2011-11-09 21:11 ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-11-09 21:11 UTC (permalink / raw)
  To: linux-arm-kernel

From: Peter Horton <phorton@bitbox.co.uk>
Date: Wed, 9 Nov 2011 12:44:11 +0000

> -	if (((unsigned long) bufaddr) & FEC_ALIGNMENT) {
> +	if ((((unsigned long) bufaddr) & FEC_ALIGNMENT) ||
> +		((id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) &&
> +		skb_cloned(skb)))
> +	{

Please format this condition properly:

	if (A ||
	    (B &&
             C)) {

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-09 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 11:17 [PATCH] iMX28 Ethernet driver fix Peter Horton
2011-11-08 12:01 ` Baruch Siach
  -- strict thread matches above, loose matches on Subject: below --
2011-11-09 12:44 Peter Horton
2011-11-09 21:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox