From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id B3990A0471 for ; Wed, 19 Jun 2019 21:00:21 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 485981D167; Wed, 19 Jun 2019 21:00:09 +0200 (CEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by dpdk.org (Postfix) with ESMTP id 6D1121D123 for ; Wed, 19 Jun 2019 21:00:04 +0200 (CEST) Received: by mail-pf1-f193.google.com with SMTP id d126so153176pfd.2 for ; Wed, 19 Jun 2019 12:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+OFQZiHQfZ8LMLFPBeuGB6NyWoetkG0/c/wPapE/X44=; b=g/bcA+5QWXWrb3sH3L7jCymdduN8yGq295Lak4tDcFh8cNaKx9BgU5NAYEJS7xqJ2I S+aQUNRfqDkSX5qnlL1esAqfZJ1S/YRwI99IuT40rFEBSKO7pmY15/Gh19I7U6a86kzq r5QzNfoSMFy8EqUnrp6yYKa6/6gbiw++23/uXjnp5FvEuiWTYhlGk3BQqnQiBXqC7kNd ab2C9Zs5t1RFBtjdI9u/HX3FTuvT1cePiF1Aihyauvd010bOPyayBc1EkWAImrcrqfnj F9hovAAoNW9zWmzcpJlZseDaX/rJsJ6yRzYWpR2uy1k2bGAI01lPG4CnQubz+CTEaAHL mDvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+OFQZiHQfZ8LMLFPBeuGB6NyWoetkG0/c/wPapE/X44=; b=nMxIBA3BTEaOekoJxOt90vDLVUwnS+UMRAaE5MISIhweJALEXHjRzCdTV16ZVJF93G 4e1qBYPINhuU2IRktKXrQyFmPzkNjNxCvmMWLauNVCweHEA03yhT2D518KabgKA13Kuo HjadsLhex5L2ReiVUqqet6NuGlQ82aagH+A2ZXSAZaFTaFhVrRko4rwTa1Ut2cmVEuY4 VgcwlW6l6E7QqdsbV30n0dskXC1yDZbljP2tyfzOwYJgrKMTQimY4yYhqoXy99jffVpG TVuFH1M6qIqBa4nHqgf/QMmWociKDFOST3fVYT7noUstAo+Jg217Z6oE0CJB9sR5HQvc SB0Q== X-Gm-Message-State: APjAAAWPCZ2tHZmw66EK0N/zpHCmgBltjbhLsbInC3azio5gaDKsvtP8 bctBr6kOeEgPoNdxtZEkQPuKypxl9dg= X-Google-Smtp-Source: APXvYqwaXCoZDADByCDsmWP2cYMy/3jaBcdRT2UJvO7ply19gC+YTfmkk7upejWsqdpaWBl9kJ0jEQ== X-Received: by 2002:a63:3d0f:: with SMTP id k15mr9145385pga.343.1560970803355; Wed, 19 Jun 2019 12:00:03 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id g8sm18613397pfi.8.2019.06.19.12.00.01 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 12:00:02 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Wed, 19 Jun 2019 11:59:52 -0700 Message-Id: <20190619185958.27306-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619185958.27306-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190619185958.27306-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 2/8] kni: use netdev_alloc_skb X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Stephen Hemminger 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 --- 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