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 D3ABBA046B for ; Mon, 24 Jun 2019 18:47:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0037C1BD20; Mon, 24 Jun 2019 18:47:31 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 756561BCEA for ; Mon, 24 Jun 2019 18:47:24 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id i189so7828412pfg.10 for ; Mon, 24 Jun 2019 09:47:24 -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=oe0geve82kPbeuTLEhiKxz5m43I4cyFj8lTlsw5/DJo=; b=ZvAXs+NaadqfMp+txId9DNOcxjlGmhuWxpQru14fcBvoRfVS/6iWv2Bm0QASICNk8i 4sf1KcF6waMoq//AU90i6IW1RJuGGIExJGsaNF8LnCZR6vKy4Q70rAqclZl/GILKme62 dBxasuXIndMNUPCkqOpCtDrj9p25i/JlwCXCx50Xppne2LW+BkLvTedan7WRS4w1OwID axOG2ikHicasmX3I6KPtNCB/yegpYhVpShQDdQ4Px0FexQe/lRBS/nQemqb4Ou2AkzEY dRxxjnAuLAm7Sndr5Kda5VTt8x2ryDzfa5JVbQr2mPMRuUU3o0dJiSBThlsJyYqHdjuu QLoQ== 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=oe0geve82kPbeuTLEhiKxz5m43I4cyFj8lTlsw5/DJo=; b=Gx2BNlR0cTZycvZd0ytWacYEqFt7U0/su5AoTGxtuxvOAoVtqHJ6GG8iIVDTUm5D4p XdID/IS2OgTHAjka9paKWZaNDyNb+kWxv7XnWKlVhHmDlt16q5kN+XWtN9lWPBmu+YRC 0IZwQMGtCksAHx6i3FWHkOFu0t2xUHuetNFAMAPhWcW5fC2+3hGcYtMqPbQX0VS+JVHv eeFm1k711gbTpxltcMp5WpeYjsUXHiYJq69mSWKXx8Y63dFkQtqOnwqB0IibZWrexrOD 3y4suUaIwpys3hMRkl2hedpbyaimebHIqqlx+4WcwlbAb87jcNKGjk/X8kcCWc9m5mC8 BUAg== X-Gm-Message-State: APjAAAWvxgHRbHoigtE8k0ArTHez6EBUYZHDMY7QWlrGEgXz+XP2OXQE ieK+vnjtigZmpcpx5PHWLC7ycFL/Nhs= X-Google-Smtp-Source: APXvYqxTAaqv1itYmnVXFndABZsB57ZSh6DREI09Rg8pb6zs4WeaEu8QbmC4jlFR4r7QzbbtHjwtzA== X-Received: by 2002:a63:d84e:: with SMTP id k14mr34016898pgj.234.1561394843288; Mon, 24 Jun 2019 09:47:23 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id f7sm12814023pfd.43.2019.06.24.09.47.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 24 Jun 2019 09:47:22 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 24 Jun 2019 09:47:07 -0700 Message-Id: <20190624164714.6560-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190624164714.6560-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190624164714.6560-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 2/9] 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" 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