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 151DBA0471 for ; Wed, 19 Jun 2019 20:58:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2C1361D0F3; Wed, 19 Jun 2019 20:58:04 +0200 (CEST) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by dpdk.org (Postfix) with ESMTP id 2AB8F1D0D9 for ; Wed, 19 Jun 2019 20:57:58 +0200 (CEST) Received: by mail-pg1-f194.google.com with SMTP id y72so168749pgd.8 for ; Wed, 19 Jun 2019 11:57:58 -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=JpyK/Sxjv08uv1gpqJ3ZWm1RGnqru91O2pvOtEYAhywzTxDNmt6vNTby6jI2M/cIXU z+GjpqRkmr2x8BIeD1kXVDmKlziG8BjSrtBh8CBtoH+rUvHzkZ/qF9SqvVA/wSU+PDIB fDmMdq6doEJQggycNipYOiLsjwPoySiGcgE+mhrlZODMtQyL24RYjwNV7GoYpn0ABtxd 0/hgw4IdCg4WhxuyRY9o4219P3w0UpDuFlwsgsPhGbrBX8MTmYs03dBHkmlIQbQAidpM RIxpF4wWBiQEX+dln6rjktSewzmrEy+KIFsFNSE7VipcKqK4oWjSAeQzL+wFyYExcBuq aTUQ== 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=jrCm8H/8r4xZTY4gAIAlNSwSviApAzDbucvahrhS4NgOuPjQ33KrJjYEAvB2DgMExm ZKpGo0Lde+JaogtTosusyVpdm8F6DrAy4BR6VVx/HlWGk0E50n6JHdcWrQvhtc6+cBaM fJImwhuhd2oolbuI3ckYz6dpCmweUQ/NB1XHs8cZ3baF+wk6on3uC3O62ndeVshGgADr ILWnCk0FA9ltKhfU5ramBU5gg2ZtieBKB6kSTDl+mwoioIT9lqK+pswsaBn7TL1TEgMu RbEo00e5hJGiGxsQK20bUm2GIgfbKUgFMa7tW5la3QVwCvwppO0vLONAgwZQBqGguk4o lBtQ== X-Gm-Message-State: APjAAAVUR9a2xT63IPqya7nCgcPKvt+3vcGOXe/r7f82ThJ3nd6KFfCY D9pMOXMkvC/u7l+UZeJGP6+v6s8aY3Y= X-Google-Smtp-Source: APXvYqyw+DCqr6SZ0crZeKbMrj6wbaYdrXKerRCCV2efaxXrF0mRs+d76IY6I8ext4pBI+1/RiMw0w== X-Received: by 2002:a17:90a:2567:: with SMTP id j94mr12725877pje.121.1560970677051; Wed, 19 Jun 2019 11:57:57 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id b8sm24774858pff.20.2019.06.19.11.57.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 11:57:56 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Stephen Hemminger Date: Wed, 19 Jun 2019 11:57:40 -0700 Message-Id: <20190619185746.26866-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190619185746.26866-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190619185746.26866-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" 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