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 C5BC8A0471 for ; Tue, 18 Jun 2019 18:17:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E5291C224; Tue, 18 Jun 2019 18:16:52 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 067B71C212 for ; Tue, 18 Jun 2019 18:16:47 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id a186so7937272pfa.5 for ; Tue, 18 Jun 2019 09:16:47 -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=gXpU5HWX1zhKob5azP1RBzGzVNIyjaF515Vtq3Mz2SLXYALp/GN9Lf8AYy87xSCDCm RTFgHhWqwAg4Cjni0aiOi1os4ZmtBFcyBbqIYITQmnq41hJ5yObQGqa5ImgEpklvZ2Ru 9nW8l44oFp9gdPzLAUbsxQ9Ea7UeiW9W8Pis7dpbSahM53JuIrmWEikJE6pmkfFAXU5B 1hWtydJK2lBBiGDvyuVO5V4DBgZYV+mniHuYLlSUswXhcNnkk3ktBX5TAACOfOdpCzC2 LmtxzMnYpDLmN5GeUguRPo0RWSb98el2oV/gyp3s/cueLwMWPRKSCi5yjXKNdZBUogRq 4upg== 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=r5+qFZ4MQxDgz08n0lgnWMZ1P2z+O6hw2abV0ypTRMUONxAcUXWeLCZ7b3Z0bOdyng USuyQ1t47M1Ar+XG4P7oz/56k79heCss06Wx0gSAzMvYVT1tEg6U8/CGcQN0OJC3Xho1 RdYcc7o2xEsuQSKy2GbT5qbUIBOhV+GWs4OSYl9WEVgWe1/YF+Dbzbr6aG/xkzOYScG7 EvCT3xQisDvMhlrTz/a9bjd460X+2X3ttlBIEhLhxnny1aXML3BxHMygPyrIZ6bLrlr7 b+KTbalclMwvauGTzN7tPkvrFIAT3saBNKydQJCLHACEhkb+L+wz3nkEvzPSDkp8LZYZ 6r0A== X-Gm-Message-State: APjAAAVVciuUL0Rb5jGMAD4Mp6Z6WuJi5sSCcLxh7fMNeWRPu1+B1M2E q8SNs0IZxk9duEissCXeL9jxWb2CwbE= X-Google-Smtp-Source: APXvYqzpeggB7lAGpnIo1h4ba9ZHbuu8n5n4dmYyAiIYnFnwWCsc8WxJGfTqecLuH3Z7a2zeC5vqUQ== X-Received: by 2002:aa7:8711:: with SMTP id b17mr64047568pfo.234.1560874606669; Tue, 18 Jun 2019 09:16:46 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 3sm15485385pfp.114.2019.06.18.09.16.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 18 Jun 2019 09:16:45 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Tue, 18 Jun 2019 09:16:30 -0700 Message-Id: <20190618161636.23748-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190618161636.23748-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190618161636.23748-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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" 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