DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH v4 2/8] kni: use netdev_alloc_skb
Date: Wed, 19 Jun 2019 11:59:52 -0700	[thread overview]
Message-ID: <20190619185958.27306-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20190619185958.27306-1-stephen@networkplumber.org>

From: Stephen Hemminger <sthemmin@microsoft.com>

netdev_alloc_skb is optimized to any alignment or setup
of skb->dev that is required. The kernel has chosen to not pad
packets on x86 (for many years), because it is faster.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 kernel/linux/kni/kni_net.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index c86337d099ab..cce5e7eb991f 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -340,16 +340,13 @@ kni_net_rx_normal(struct kni_dev *kni)
 		data_kva = kva2data_kva(kva);
 		kni->va[i] = pa2va(kni->pa[i], kva);
 
-		skb = dev_alloc_skb(len + 2);
+		skb = netdev_alloc_skb(dev, len);
 		if (!skb) {
 			/* Update statistics */
 			kni->stats.rx_dropped++;
 			continue;
 		}
 
-		/* Align IP on 16B boundary */
-		skb_reserve(skb, 2);
-
 		if (kva->nb_segs == 1) {
 			memcpy(skb_put(skb, len), data_kva, len);
 		} else {
@@ -368,7 +365,6 @@ kni_net_rx_normal(struct kni_dev *kni)
 			}
 		}
 
-		skb->dev = dev;
 		skb->protocol = eth_type_trans(skb, dev);
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
@@ -512,26 +508,20 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
 		data_kva = kva2data_kva(kva);
 		kni->va[i] = pa2va(kni->pa[i], kva);
 
-		skb = dev_alloc_skb(len + 2);
+		skb = netdev_alloc_skb(dev, len);
 		if (skb) {
-			/* Align IP on 16B boundary */
-			skb_reserve(skb, 2);
 			memcpy(skb_put(skb, len), data_kva, len);
-			skb->dev = dev;
 			skb->ip_summed = CHECKSUM_UNNECESSARY;
 			dev_kfree_skb(skb);
 		}
 
 		/* Simulate real usage, allocate/copy skb twice */
-		skb = dev_alloc_skb(len + 2);
+		skb = netdev_alloc_skb(dev, len);
 		if (skb == NULL) {
 			kni->stats.rx_dropped++;
 			continue;
 		}
 
-		/* Align IP on 16B boundary */
-		skb_reserve(skb, 2);
-
 		if (kva->nb_segs == 1) {
 			memcpy(skb_put(skb, len), data_kva, len);
 		} else {
@@ -550,7 +540,6 @@ kni_net_rx_lo_fifo_skb(struct kni_dev *kni)
 			}
 		}
 
-		skb->dev = dev;
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 		kni->stats.rx_bytes += len;
-- 
2.20.1


  parent reply	other threads:[~2019-06-19 19:00 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 17:51 [dpdk-dev] [PATCH v2 0/7] kni: cleanups and improvements Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 1/7] kni: don't need stubs for rx_mode or ioctl Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 2/7] kni: use netdev_alloc_skb Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 3/7] kni: don't keep stats in kni_net Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 4/7] kni: drop unused fields Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 5/7] kni: use proper type for kni fifo's Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 6/7] kni: return -EFAULT if copy_from_user fails Stephen Hemminger
2019-06-10 17:51 ` [dpdk-dev] [PATCH v2 7/7] doc: update KNI documentation Stephen Hemminger
2019-06-11 20:54 ` [dpdk-dev] [PATCH v2 0/7] kni: cleanups and improvements Stephen Hemminger
2019-06-11 21:18   ` Lance Richardson
2019-06-11 21:30     ` Stephen Hemminger
2019-06-11 21:49       ` Lance Richardson
2019-06-18 16:16 ` [dpdk-dev] [PATCH v3 0/8] kni: fixes and cleanups Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 1/8] kni: don't need stubs for rx_mode or ioctl Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 2/8] kni: use netdev_alloc_skb Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 3/8] kni: don't keep stats in kni_net Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 4/8] kni: drop unused fields Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 5/8] kni: use proper type for kni fifo's Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 6/8] kni: return -EFAULT if copy_from_user fails Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 7/8] doc: update KNI documentation Stephen Hemminger
2019-06-18 16:16   ` [dpdk-dev] [PATCH v3 8/8] kni: fix style issues Stephen Hemminger
2019-06-19 18:57 ` [dpdk-dev] [PATCH v3 0/8] kni: cleanups and fixes Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 1/8] kni: don't need stubs for rx_mode or ioctl Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 2/8] kni: use netdev_alloc_skb Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 3/8] kni: don't keep stats in kni_net Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 4/8] kni: drop unused fields Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 5/8] kni: use proper type for kni fifo's Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 6/8] kni: return -EFAULT if copy_from_user fails Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 7/8] doc: update KNI documentation Stephen Hemminger
2019-06-19 18:57   ` [dpdk-dev] [PATCH v3 8/8] kni: fix style issues Stephen Hemminger
2019-06-19 18:59 ` [dpdk-dev] [PATCH v4 0/8] kni: fixes and cleanups Stephen Hemminger
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 1/8] kni: don't need stubs for rx_mode or ioctl Stephen Hemminger
2019-06-19 18:59   ` Stephen Hemminger [this message]
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 3/8] kni: don't keep stats in kni_net Stephen Hemminger
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 4/8] kni: drop unused fields Stephen Hemminger
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 5/8] kni: use proper type for kni fifo's Stephen Hemminger
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 6/8] kni: return -EFAULT if copy_from_user fails Stephen Hemminger
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 7/8] doc: update KNI documentation Stephen Hemminger
2019-06-19 18:59   ` [dpdk-dev] [PATCH v4 8/8] kni: fix style issues Stephen Hemminger
2019-06-20 19:20 ` [dpdk-dev] [PATCH v5 0/9] kni: fixes and cleanups Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 1/9] kni: don't need stubs for rx_mode or ioctl Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 2/9] kni: use netdev_alloc_skb Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 3/9] kni: don't keep stats in kni_net Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 4/9] kni: drop unused fields Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 5/9] kni: use proper type for kni fifo's Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 6/9] kni: return -EFAULT if copy_from_user fails Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 7/9] doc: update KNI documentation Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 8/9] kni: fix style issues Stephen Hemminger
2019-06-20 19:20   ` [dpdk-dev] [PATCH v5 9/9] kni: add minimal ethtool Stephen Hemminger
2019-06-21  8:26     ` Igor Ryzhov
2019-06-21 15:10       ` Stephen Hemminger
2019-06-24 16:47 ` [dpdk-dev] [PATCH v6 0/9] kni: fixes and cleanups Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 1/9] kni: don't need stubs for rx_mode or ioctl Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 2/9] kni: use netdev_alloc_skb Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 3/9] kni: don't keep stats in kni_net Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 4/9] kni: drop unused fields Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 5/9] kni: use proper type for kni fifo's Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 6/9] kni: return -EFAULT if copy_from_user fails Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 7/9] kni: fix style issues Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 8/9] kni: add minimal ethtool Stephen Hemminger
2019-06-24 16:47   ` [dpdk-dev] [PATCH v6 9/9] doc: update KNI documentation Stephen Hemminger
2019-07-12 17:03   ` [dpdk-dev] [PATCH v6 0/9] kni: fixes and cleanups Ferruh Yigit
2019-07-15 17:18     ` Thomas Monjalon

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=20190619185958.27306-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=sthemmin@microsoft.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).