All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeff Garzik <jgarzik@pobox.com>,
	Cesar Eduardo Barros <cesarb@cesarb.net>
Cc: netdev@vger.kernel.org, tom@sharkbay.at
Subject: [PATCH 2/3] sc92031: start transmit return value bugfix
Date: Wed, 2 Apr 2008 10:11:11 -0700	[thread overview]
Message-ID: <20080402101111.7f01a18c@extreme> (raw)
In-Reply-To: <20080402094923.185f15dc@extreme>

Any negative return value from start_xmit is interpreted as NETDEV_TX_LOCK
which is not what this driver wants. It should return 0 (NETDEV_TX_OK)
when it consumes a packet.

Also, use skb_padto() as the generic way to pad small frames.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/sc92031.c	2008-04-02 09:50:22.000000000 -0700
+++ b/drivers/net/sc92031.c	2008-04-02 09:53:15.000000000 -0700
@@ -947,16 +947,16 @@ static struct net_device_stats *sc92031_
 
 static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	int err = 0;
 	struct sc92031_priv *priv = netdev_priv(dev);
 	void __iomem *port_base = priv->port_base;
-
 	unsigned len;
 	unsigned entry;
 	u32 tx_status;
 
+	if (skb_padto(skb, ETH_ZLEN))
+		return NETDEV_TX_OK;
+
 	if (unlikely(skb->len > TX_BUF_SIZE)) {
-		err = -EMSGSIZE;
 		dev->stats.tx_dropped++;
 		goto out;
 	}
@@ -964,7 +964,6 @@ static int sc92031_start_xmit(struct sk_
 	spin_lock(&priv->lock);
 
 	if (unlikely(!netif_carrier_ok(dev))) {
-		err = -ENOLINK;
 		dev->stats.tx_dropped++;
 		goto out_unlock;
 	}
@@ -976,11 +975,6 @@ static int sc92031_start_xmit(struct sk_
 	skb_copy_and_csum_dev(skb, priv->tx_bufs + entry * TX_BUF_SIZE);
 
 	len = skb->len;
-	if (unlikely(len < ETH_ZLEN)) {
-		memset(priv->tx_bufs + entry * TX_BUF_SIZE + len,
-				0, ETH_ZLEN - len);
-		len = ETH_ZLEN;
-	}
 
 	wmb();
 
@@ -1007,7 +1001,7 @@ out_unlock:
 out:
 	dev_kfree_skb(skb);
 
-	return err;
+	return NETDEV_TX_OK;
 }
 
 static int sc92031_open(struct net_device *dev)

  parent reply	other threads:[~2008-04-02 17:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-10380-10286@http.bugzilla.kernel.org/>
2008-04-02 16:14 ` [Bugme-new] [Bug 10380] New: sc92031 does not create a device link in sysfs Andrew Morton
2008-04-02 16:39   ` [PATCH] sc92031: sysfs link missing Stephen Hemminger
2008-04-04  5:46     ` Jeff Garzik
2008-04-04  5:52       ` Andrew Morton
2008-04-04  6:40         ` Jeff Garzik
2008-04-02 16:49   ` [Bugme-new] [Bug 10380] New: sc92031 does not create a device link in sysfs Stephen Hemminger
2008-04-02 17:08     ` [PATCH 1/3] sc92031: use net_device stats Stephen Hemminger
2008-04-02 17:08     ` [Bugme-new] [Bug 10380] New: sc92031 does not create a device link in sysfs Thomas Scheiblauer
2008-04-02 17:11     ` Stephen Hemminger [this message]
2008-04-02 17:11     ` [PATCH 1/3] sc92031: use net_device stats Stephen Hemminger
2008-04-12  9:02       ` Jeff Garzik
2008-04-02 17:13     ` [PATCH 3/3] sc92031: use netdev_alloc_skb Stephen Hemminger

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=20080402101111.7f01a18c@extreme \
    --to=shemminger@vyatta.com \
    --cc=cesarb@cesarb.net \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@sharkbay.at \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.