From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B2A1A046B for ; Thu, 25 Jul 2019 10:18:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 79F441C29F; Thu, 25 Jul 2019 10:18:45 +0200 (CEST) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by dpdk.org (Postfix) with ESMTP id 142061C274 for ; Thu, 25 Jul 2019 10:18:44 +0200 (CEST) Received: by mail-io1-f67.google.com with SMTP id s7so95311982iob.11 for ; Thu, 25 Jul 2019 01:18:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PmN63z9Ic1RZVSkI31eIoYwQ/Ps+wUK7MIE49ZIwi30=; b=bYNp26Kv4H2smguQzOdLehmEx8QPEU6f50cZRCnwj94sDS5coukE+1luLgtXP/5F2K OCHkKgSr0rk3asXu4orJ7WFO+QVqCMKrI7cMiGOuRbEareB4ijZE8SrU8bPV8vnZMbHQ f5P7+rKQXatiHGWPuSVtZ8wy8heQ3M7NSHJkplBboAZ41lzuSXcS5Ig9NoWkTtRi7ASn lGm/62RaRA/LooclZ53XlVEbyY31zYZam5XwQIVU0sclH26YZWe1k+bAdJkbqx9WnX5q vaE139nHvh8PqTSISpwZ9m4gHcZ6Fr3aeIFHlwoYSCBtaob2XDTFMaWc/ALZhRva2Ui5 0FEg== X-Gm-Message-State: APjAAAXFewFj3GbIHTcdzHTP5oTNm8HBbW3Mg7gTf0sfPNoVs4GolAHx a7leCD91Be9nyOYqoGB5GfX2rMae3JGk8LRI5TFdvw== X-Google-Smtp-Source: APXvYqwHg9bFJQ+eAY99Ikb66WAFjtzCT+ZWYadGp8K4GVCveUNRZZQH9YBZ6Pt2/ypwUIIhdTydJMOegPiVWdfbhGw= X-Received: by 2002:a02:ad15:: with SMTP id s21mr92630366jan.47.1564042723441; Thu, 25 Jul 2019 01:18:43 -0700 (PDT) MIME-Version: 1.0 References: <1563969270-29669-1-git-send-email-david.marchand@redhat.com> <1563969270-29669-4-git-send-email-david.marchand@redhat.com> In-Reply-To: <1563969270-29669-4-git-send-email-david.marchand@redhat.com> From: David Marchand Date: Thu, 25 Jul 2019 10:18:32 +0200 Message-ID: To: "Yigit, Ferruh" Cc: dpdk stable , dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH 3/3] net/pcap: fix concurrent multiseg packet transmits 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" On Wed, Jul 24, 2019 at 1:55 PM David Marchand wrote: > > Two cores can send multi segment packets on two different pcap ports. > Because of this, we can't have one single buffer to linearize packets. > > Use rte_pktmbuf_read() to copy the packet into a buffer on the stack > and remove eth_pcap_gather_data(). > > Fixes: 6db141c91e1f ("pcap: support jumbo frames") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand > --- > drivers/net/pcap/rte_eth_pcap.c | 90 +++++++++++++++-------------------------- > 1 file changed, 32 insertions(+), 58 deletions(-) > > diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c > index 5e5aab7..7398b1b 100644 > --- a/drivers/net/pcap/rte_eth_pcap.c > +++ b/drivers/net/pcap/rte_eth_pcap.c [snip] > @@ -336,31 +323,25 @@ struct pmd_devargs_all { > * dumper */ > for (i = 0; i < nb_pkts; i++) { > mbuf = bufs[i]; > - calculate_timestamp(&header.ts); > - header.len = mbuf->pkt_len; > - header.caplen = header.len; > - > - if (likely(mbuf->nb_segs == 1)) { > - pcap_dump((u_char *)dumper, &header, > - rte_pktmbuf_mtod(mbuf, void*)); > + len = rte_pktmbuf_pkt_len(mbuf); > + if (likely(rte_pktmbuf_is_contiguous(mbuf))) { > + data = rte_pktmbuf_mtod(mbuf, unsigned char *); > + } else if (len <= sizeof(_data)) { > + data = rte_pktmbuf_read(mbuf, 0, len, _data); We can actually skip the check on contiguous data, since rte_pktmbuf_read returns a pointer to the mbuf data without copying. WDYT ? -- David Marchand