netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Tushar Dave <tushar.n.dave@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 05/14] igb: Correcting and improving small packet check and padding
Date: Fri, 19 Oct 2012 04:45:05 -0700	[thread overview]
Message-ID: <1350647114-6768-6-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1350647114-6768-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Tushar Dave <tushar.n.dave@intel.com>

Current implementation mess up the tail pointer. This patch sets skb->tail
correctly.
Also, the small packet check and padding is optimized by using unlikely and
calling skb_pad directly.

Signed-off-by: Tushar Dave <tushar.n.dave@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index e1ceb37..c611cff 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -4467,10 +4467,11 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
 	 * The minimum packet size with TCTL.PSP set is 17 so pad the skb
 	 * in order to meet this minimum size requirement.
 	 */
-	if (skb->len < 17) {
-		if (skb_padto(skb, 17))
+	if (unlikely(skb->len < 17)) {
+		if (skb_pad(skb, 17 - skb->len))
 			return NETDEV_TX_OK;
 		skb->len = 17;
+		skb_set_tail_pointer(skb, 17);
 	}
 
 	return igb_xmit_frame_ring(skb, igb_tx_queue_mapping(adapter, skb));
-- 
1.7.11.7

  parent reply	other threads:[~2012-10-19 11:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 11:45 [net-next 00/14][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2012-10-19 11:45 ` [net-next 01/14] ixgbe: Initialize q_vector cpu and affinity masks correctly Jeff Kirsher
2012-10-19 11:45 ` [net-next 02/14] ixgbe: Enable jumbo frames support w/ SR-IOV Jeff Kirsher
2012-10-19 11:45 ` [net-next 03/14] ixgbe: Move message handling routines into their own functions Jeff Kirsher
2012-10-19 11:45 ` [net-next 04/14] ixgbe: Add mailbox API version negotiation support to ixgbe PF Jeff Kirsher
2012-10-19 11:45 ` Jeff Kirsher [this message]
2012-10-19 11:45 ` [net-next 06/14] igb: Split Rx timestamping into two separate functions Jeff Kirsher
2012-10-19 11:45 ` [net-next 07/14] igb: Do not use header split, instead receive all frames into a single buffer Jeff Kirsher
2012-10-19 11:45 ` [net-next 08/14] igb: Combine post-processing of skb into a single function Jeff Kirsher
2012-10-19 13:49   ` David Laight
2012-10-19 14:32     ` Eric Dumazet
2012-10-19 11:45 ` [net-next 09/14] igb: Map entire page and sync half instead of mapping and unmapping half pages Jeff Kirsher
2012-10-19 11:45 ` [net-next 10/14] igb: Move rx_buffer related code in Rx cleanup path into separate function Jeff Kirsher
2012-10-19 11:45 ` [net-next 11/14] igb: Lock buffer size at 2K even on systems with larger pages Jeff Kirsher
2012-10-19 11:45 ` [net-next 12/14] igb: Combine q_vector and ring allocation into a single function Jeff Kirsher
2012-10-19 11:45 ` [net-next 13/14] igb: Move the calls to set the Tx and Rx queues into igb_open Jeff Kirsher
2012-10-19 11:45 ` [net-next 14/14] igb: Split igb_update_dca into separate Tx and Rx functions Jeff Kirsher
2012-10-20  2:36 ` [net-next 00/14][pull request] Intel Wired LAN Driver 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=1350647114-6768-6-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    --cc=tushar.n.dave@intel.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).