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 D35FAA00E6 for ; Mon, 10 Jun 2019 19:52:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F274D1C18E; Mon, 10 Jun 2019 19:52:05 +0200 (CEST) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id B7BC01C12F for ; Mon, 10 Jun 2019 19:52:01 +0200 (CEST) Received: by mail-pg1-f196.google.com with SMTP id w34so5410907pga.12 for ; Mon, 10 Jun 2019 10:52:01 -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=3nH3VS2nrDhr++GW5IK4H1gOU9hAjtyIvaPds5/nwF4=; b=0zVCJjRpRJ2q2RzltXvValRWeX1sDfBvV+NFk5N9XoiXOq7vsoWRCcCIe8JHjuOOkk 3nq1yp2Xo9GIWYAeexlHiUzGLlysEGzr2m9/KRQWNEXYmTv6k3iDVlQoC8sUd6dnTw1J 5I/fsyT8TMyFzmXCUk60BsdW7nyK9icTP6QLyAQzfldJ1E2Ipw+Q4YJ4AJTIX2LyWNyW ijMtVRE8tTP1wF7eUqAreTrQE66PAYt4UIZpE/uLBGERZs6VosMFmGuhs/9vxA9WDE4t BAM3/nuo/FH0OCHsCQrlmuCYPCB5tMsdUaz8AOU04gwXI3cbivedsWirqAJw1ROuC2LG Welg== 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=3nH3VS2nrDhr++GW5IK4H1gOU9hAjtyIvaPds5/nwF4=; b=Fp5Y1y5pMKr4uXAREH0KeVILcUxjwRmyYG0rRZ865yo3ZWqudMFDOPS6fwHLUS+TH2 h8iBhMMOCMABRQYPozaRukryw/fK9k+TgGkyk6NdasC2Pt8ojmXeeKnMSXeB9OkfXrm7 iOzHv1tkyz4EaACSWvrrdEGOz46RE3XIU3Ug1VJzKBa9/Fi04zFX/5D13+MlvqJBntr7 zvJJrtLvYeuLOlyWhnDboLR4+9VT7wnlluEE7oBENvS4UH8x+2LPJw77BH3FL2iLW8oa ps0ctUnz9WAk3UW+NpvbzxZWzM2hxGIZZy7DVCMJGTbFypArUfYR/wezpqgEynzcsNjC KSjw== X-Gm-Message-State: APjAAAW0kdjLxKVvSZtvSjAM0J0O8YTUi5DYVJdFlunKb1D9Lm2syIFZ 69S4sy6ceQHvnID5Arwqx5DkNw== X-Google-Smtp-Source: APXvYqxXF97m6TeGnme0G2dbZhJANYev6Iddqt/pqsQSuhuJ591+PB4gDgAiWsGw5zS2sWZPyvuP8w== X-Received: by 2002:aa7:956d:: with SMTP id x13mr36332710pfq.132.1560189120830; Mon, 10 Jun 2019 10:52:00 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l38sm131656pje.12.2019.06.10.10.51.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 10 Jun 2019 10:51:59 -0700 (PDT) From: Stephen Hemminger To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Stephen Hemminger Date: Mon, 10 Jun 2019 10:51:50 -0700 Message-Id: <20190610175155.21374-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190610175155.21374-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/7] 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 intentionall does not pad packets on x86, 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