netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next 3/9] net: r6040: Utilize skb_put_padto()
Date: Mon,  4 Jul 2016 14:36:03 -0700	[thread overview]
Message-ID: <1467668169-31547-4-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1467668169-31547-1-git-send-email-f.fainelli@gmail.com>

Pad the SKB to the minimum length of ETH_ZLEN by using skb_put_padto()
and take this operation out of the critical section since there is no
need to check any HW resources before doing that.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/rdc/r6040.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 75776eee36f9..46ed093348da 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -815,6 +815,9 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
 	void __iomem *ioaddr = lp->base;
 	unsigned long flags;
 
+	if (skb_put_padto(skb, ETH_ZLEN) < 0)
+		return NETDEV_TX_OK;
+
 	/* Critical Section */
 	spin_lock_irqsave(&lp->lock, flags);
 
@@ -829,11 +832,7 @@ static netdev_tx_t r6040_start_xmit(struct sk_buff *skb,
 	/* Set TX descriptor & Transmit it */
 	lp->tx_free_desc--;
 	descptr = lp->tx_insert_ptr;
-	if (skb->len < ETH_ZLEN)
-		descptr->len = ETH_ZLEN;
-	else
-		descptr->len = skb->len;
-
+	descptr->len = skb->len;
 	descptr->skb_ptr = skb;
 	descptr->buf = cpu_to_le32(pci_map_single(lp->pdev,
 		skb->data, skb->len, PCI_DMA_TODEVICE));
-- 
2.7.4

  parent reply	other threads:[~2016-07-04 21:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04 21:36 [PATCH net-next 0/9] net: r6040: Misc updates Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 1/9] net: r6040: Utilize phy_print_status Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 2/9] net: r6040: Increase statistics upon transmit completion Florian Fainelli
2016-07-04 21:36 ` Florian Fainelli [this message]
2016-07-05 22:44   ` [PATCH net-next 3/9] net: r6040: Utilize skb_put_padto() Francois Romieu
2016-07-04 21:36 ` [PATCH net-next 4/9] net: r6040: Reclaim transmitted buffers in NAPI Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 5/9] net: r6040: Check for skb->xmit_more Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 6/9] net: r6040: Utilize __napi_schedule_irqoff Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 7/9] net: r6040: Utilize napi_complete_done() Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 8/9] net: r6040: Update my email Florian Fainelli
2016-07-04 21:36 ` [PATCH net-next 9/9] net: r6040: Bump version and date Florian Fainelli
2016-07-05  7:12 ` [PATCH net-next 0/9] net: r6040: Misc updates David Miller

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=1467668169-31547-4-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --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).