netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: edumazet@google.com, Florian Fainelli <f.fainelli@gmail.com>,
	davem@davemloft.net, jaedon.shin@gmail.com, pgynther@google.com
Subject: [PATCH net-next 1/2] net: bcmgenet: use skb_put_padto()
Date: Fri, 13 Mar 2015 15:58:31 -0700	[thread overview]
Message-ID: <1426287512-10742-2-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1426287512-10742-1-git-send-email-f.fainelli@gmail.com>

We use skb_pad() to pad small packets, and then we need to enforce again
in bcmgenet_xmit() a check on ETH_ZLEN. Use skb_put_padto() which pads
up to the specified length and also increases skb->len accordingly. Note
that we still need to use skb_headlen() since we might transmitting the
first part out of a train of fragments.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index e74ae628bbb9..cee86c24b35f 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1108,8 +1108,7 @@ static int bcmgenet_xmit_single(struct net_device *dev,
 
 	tx_cb_ptr->skb = skb;
 
-	skb_len = skb_headlen(skb) < ETH_ZLEN ? ETH_ZLEN : skb_headlen(skb);
-
+	skb_len = skb_headlen(skb);
 	mapping = dma_map_single(kdev, skb->data, skb_len, DMA_TO_DEVICE);
 	ret = dma_mapping_error(kdev, mapping);
 	if (ret) {
@@ -1272,7 +1271,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 		goto out;
 	}
 
-	if (skb_padto(skb, ETH_ZLEN)) {
+	if (skb_put_padto(skb, ETH_ZLEN)) {
 		ret = NETDEV_TX_OK;
 		goto out;
 	}
-- 
2.1.0

  reply	other threads:[~2015-03-13 22:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 22:58 [PATCH net-next 0/2] net: bcmgenet: Byte Queue Limits support Florian Fainelli
2015-03-13 22:58 ` Florian Fainelli [this message]
2015-03-14  4:48   ` [PATCH net-next 1/2] net: bcmgenet: use skb_put_padto() Jaedon Shin
2015-03-13 22:58 ` [PATCH net-next 2/2] net: bcmgenet: add byte queue limits support Florian Fainelli
2015-03-13 23:03 ` [PATCH net-next 0/2] net: bcmgenet: Byte Queue Limits support Florian Fainelli
2015-03-13 23:13   ` 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=1426287512-10742-2-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jaedon.shin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pgynther@google.com \
    /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).