netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fugang Duan <B38611@freescale.com>
To: <davem@davemloft.net>, <b20596@freescale.com>
Cc: <netdev@vger.kernel.org>, <b38611@freescale.com>,
	<bhutchings@solarflare.com>, <l.stach@pengutronix.de>
Subject: [PATCH] net: fec: fix the error to get the previous BD entry
Date: Fri, 30 Aug 2013 12:35:25 +0800	[thread overview]
Message-ID: <1377837325-5232-1-git-send-email-B38611@freescale.com> (raw)

When the current BD is the first BD, the previous BD entry
must be the last BD, not "bdp - 1".

Add BD entry check to get the previous BD entry correctly.

Signed-off-by: Fugang Duan  <B38611@freescale.com>
---
 drivers/net/ethernet/freescale/fec_main.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4ea1555..b13746f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -380,7 +380,15 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 		}
 	}
 
-	bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+	if (bdp == fep->tx_bd_base) {
+		if (fep->bufdesc_ex)
+			bdp_pre = (struct bufdesc *)((void *)bdp +
+				(sizeof(struct bufdesc_ex) * (TX_RING_SIZE - 1)));
+		else
+			bdp_pre = bdp + TX_RING_SIZE - 1;
+	} else {
+		bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex);
+	}
 	if ((id_entry->driver_data & FEC_QUIRK_ERR006358) &&
 	    !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) {
 		fep->delay_work.trig_tx = true;
-- 
1.7.1

             reply	other threads:[~2013-08-30  4:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  4:35 Fugang Duan [this message]
2013-08-30 21:59 ` [PATCH] net: fec: fix the error to get the previous BD entry David Miller
2013-09-02  1:37   ` Duan Fugang-B38611
2013-09-02  2:09     ` Li Frank-B20596
2013-09-02  2:23       ` Duan Fugang-B38611
2013-09-02  2:25         ` Li Frank-B20596
  -- strict thread matches above, loose matches on Subject: below --
2013-09-03  2:41 Fugang Duan
2013-09-03  3:00 ` Li Frank-B20596
2013-09-03  3:35   ` David Miller
2013-09-03 15:10     ` Li Frank-B20596
2013-09-03 15:14       ` Fabio Estevam
2013-09-03 15:20         ` Li Frank-B20596
2013-09-04 18:13 ` David Miller
2013-09-03  2:18 Fugang Duan
2013-09-03  2:33 ` Li Frank-B20596
2013-09-03  2:49   ` Duan Fugang-B38611
2013-09-02 11:35 Fugang Duan
2013-09-02 14:30 ` Li Frank-B20596
2013-09-03  1:39   ` Duan Fugang-B38611
2013-08-22 10:40 Fugang Duan
2013-08-22 14:14 ` Li Frank-B20596

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377837325-5232-1-git-send-email-B38611@freescale.com \
    --to=b38611@freescale.com \
    --cc=b20596@freescale.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=l.stach@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).