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 AFFAAA0471 for ; Thu, 20 Jun 2019 21:21:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 572511D46E; Thu, 20 Jun 2019 21:21:06 +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 40EB71D463 for ; Thu, 20 Jun 2019 21:21:00 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id q10so2201523pff.9 for ; Thu, 20 Jun 2019 12:21:00 -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=ZhBu3lmWOfs+tTwZ2IPZPXzRj/JtTSSNeAOD0LPbWHgGgViU9TDno3X9ScoDmX8gUL Bpj3MhaLfLi2dkpSnmFyznT9CenudlPn49Vl2VpAKHMrk4OI9ush5M9zEhOZCjF3I3RM vrM1mCksVm28tzcjYToISh8fK4Jx84B7YVTliZQ4D8S7G0s3xndaeNLT3FnWCskMCyXz MHdumeHT+FDeuqdsN04AGCEGRr+cnyv3Sz1hEyfK+RRxlUhAXod2o+cfKqeGqPOuKK7V WL7bfMv85IsoopVbEhMyxzARscYZj3vRTvLKwVpO9Ai3A4RAhdn1d9Iv5p7FXbsEKYoa nwoQ== 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=dNx4vgw+xQoK5PzZgKptiUwSrWOlAz0VG4UaGYeGBLOXxnnneW2llenPL72wanAQ0C l67RFZZyh4sn1ZkOKQF1eUNOYCmjWynRQud9cG4N8/q10Tm5cNocAjsc1AM18TSBvU8Z RQj0B0s3GxV6ipk7snAxm5aTZkZFzq+I3PLnWUMnoEc8mrbYWFfzwCV61KopdTkjnVM0 RtC5FRx9x4lrGeN1iAqcZeZSMB2f2SvdZC0glD75536Sp6miJhGm9rJi1MiEkaSJ6eVc MXxSe889kYpaRRipAdkIqVhcSWM6d0XBSidyvChgomafPU20NxHq6ovbCtHmnSB6VK2R TEug== X-Gm-Message-State: APjAAAVYSzOnAZsEC0Pwf7r+3O8ALHVjKlAG6ZGWH3rJNWy3CdwFNFf9 NNzbesUhCBroQI9B+pZjHd7HbfpR3xM= X-Google-Smtp-Source: APXvYqyfzrBXEnX3CcBd0D+JcZjehII+mrPhJEZ5UfdgCEO4MdqnZKPQCRZYyI1PLjrxCiTJHbcx4g== X-Received: by 2002:a65:5a42:: with SMTP id z2mr14583259pgs.421.1561058458967; Thu, 20 Jun 2019 12:20:58 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j11sm255703pfa.2.2019.06.20.12.20.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 20 Jun 2019 12:20:57 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 20 Jun 2019 12:20:41 -0700 Message-Id: <20190620192048.13814-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190620192048.13814-1-stephen@networkplumber.org> References: <20190610175155.21374-1-stephen@networkplumber.org> <20190620192048.13814-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 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