From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id 55F14108A for ; Mon, 6 Mar 2017 15:18:58 +0100 (CET) Received: by mail-wr0-f173.google.com with SMTP id g10so117533901wrg.2 for ; Mon, 06 Mar 2017 06:18:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=c2n8mdes51M64kZHwYtJ8larOjElcuTht13kHiyLiz8=; b=V/QWA21dBzGA1/mYeyTpKlvEA0gGWVPvYJSiZMwDfa+/+92xLJGYDfemfc5nfvrsMO Sx6bGViK7LrJ5K9DFr3ep6CKVcWEpDOtER4A8iS8/GleIQCUpl74+XwhvcnsSTXQwNJB mmtwbVjmjX0HjlUp0h9Fc7rPTRM0aKREPLHWQbiLbgou2tMqYBm+/HxPfuNG/F0z4QRQ k7JCNKSuKjE42A193sce/1gilfxbV4/m+HIvSJldF36kjQihRGangmbD/9zAlzy2oVm+ vTEk142KnTVUgrK49hLZWkkFyT6tKfnNreq6Uqj0gvT3UDTNElcvcSY9iXFS8Ww+jdBG AsNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=c2n8mdes51M64kZHwYtJ8larOjElcuTht13kHiyLiz8=; b=U+lvsONlizzJJXWzYyEIk+BsWC+cQ4w1FC1hDdE+tDwetjf1k3baiXwi/o9HcIaT9L HRXxHMLqraJZYNLPMKCeObCNAI2FI4srQUW1MxhFxLdHPDM8PW2zuhX5nW0/GNxFsa58 j74LUYKrPo79qAF8fqyS7wbSXq1I1ydhi8B/v7wRzcDt6YHb9Dkv7ThHEz6ulAI2oZ0w JsB8y8FuO2747X5Pg/VDFiJ4GsfGbeUtYMjPBPh5rBhIId/XlnlNO9J0O/BVu0kyyaL/ HrnlSm9cH49bTF4SKbSGNbBgi5rps5DafWyVcLMtXN1ZWJOAZR/D1vVlwQstOPxIETHe E/GQ== X-Gm-Message-State: AMke39kTUWcd1vNgtgFEIjp7OCtrc+d0T2h6Lg17Tqff0xI5TkS4gd57hGtA1ENHNDviKFIE X-Received: by 10.223.165.85 with SMTP id j21mr14006308wrb.186.1488809938049; Mon, 06 Mar 2017 06:18:58 -0800 (PST) Received: from paques.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id k8sm27020960wre.19.2017.03.06.06.18.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 06:18:57 -0800 (PST) Date: Mon, 6 Mar 2017 15:18:49 +0100 From: Pascal Mazon To: "Wiles, Keith" Cc: "dev@dpdk.org" Message-ID: <20170306151849.7bc1f8ca@paques.dev.6wind.com> In-Reply-To: References: <20743012cc151e3dfd30eff7ef0f6a03b75ac0c9.1488537600.git.pascal.mazon@6wind.com> Organization: 6WIND X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/4] net/tap: move private elements to external header 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: , X-List-Received-Date: Mon, 06 Mar 2017 14:18:58 -0000 On Fri, 3 Mar 2017 15:38:11 +0000 "Wiles, Keith" wrote: > > > On Mar 3, 2017, at 4:45 AM, Pascal Mazon > > wrote: > > > > In the next patch, access to struct pmd_internals will be necessary > > in tap_flow.c to store the flows. > > > > Signed-off-by: Pascal Mazon > > Acked-by: Olga Shern > > --- > > drivers/net/tap/Makefile | 1 + > > drivers/net/tap/rte_eth_tap.c | 34 ++------------------ > > drivers/net/tap/tap.h | 73 > > +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 > > insertions(+), 32 deletions(-) create mode 100644 > > drivers/net/tap/tap.h > > > > diff --git a/drivers/net/tap/Makefile b/drivers/net/tap/Makefile > > index e18f30c56f52..bdbe69e62a4e 100644 > > --- a/drivers/net/tap/Makefile > > +++ b/drivers/net/tap/Makefile > > @@ -40,6 +40,7 @@ EXPORT_MAP := rte_pmd_tap_version.map > > LIBABIVER := 1 > > > > CFLAGS += -O3 > > +CFLAGS += -I$(SRCDIR) > > CFLAGS += $(WERROR_FLAGS) > > > > # > > diff --git a/drivers/net/tap/rte_eth_tap.c > > b/drivers/net/tap/rte_eth_tap.c index 3fd057225ab3..fa57d645f3b1 > > 100644 --- a/drivers/net/tap/rte_eth_tap.c > > +++ b/drivers/net/tap/rte_eth_tap.c > > @@ -51,6 +51,8 @@ > > #include > > #include > > > > +#include > > + > > /* Linux based path to the TUN device */ > > #define TUN_TAP_DEV_PATH "/dev/net/tun" > > #define DEFAULT_TAP_NAME "dtap" > > @@ -83,38 +85,6 @@ static struct rte_eth_link pmd_link = { > > .link_autoneg = ETH_LINK_SPEED_AUTONEG > > }; > > > > -struct pkt_stats { > > - uint64_t opackets; /* Number of output > > packets */ > > - uint64_t ipackets; /* Number of input > > packets */ > > - uint64_t obytes; /* Number of bytes on > > output */ > > - uint64_t ibytes; /* Number of bytes on > > input */ > > - uint64_t errs; /* Number of error > > packets */ -}; > > - > > -struct rx_queue { > > - struct rte_mempool *mp; /* Mempool for RX > > packets */ > > - uint16_t in_port; /* Port ID */ > > - int fd; > > - > > - struct pkt_stats stats; /* Stats for this > > RX queue */ -}; > > - > > -struct tx_queue { > > - int fd; > > - struct pkt_stats stats; /* Stats for this > > TX queue */ -}; > > - > > -struct pmd_internals { > > - char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap > > device name */ > > - uint16_t nb_queues; /* Number of queues > > supported */ > > - struct ether_addr eth_addr; /* Mac address of the > > device port */ - > > - int if_index; /* IF_INDEX for the > > port */ - > > - struct rx_queue rxq[RTE_PMD_TAP_MAX_QUEUES]; /* > > List of RX queues */ > > - struct tx_queue txq[RTE_PMD_TAP_MAX_QUEUES]; /* > > List of TX queues */ -}; > > - > > /* Tun/Tap allocation routine > > * > > * name is the number of the interface to use, unless NULL to take > > the host diff --git a/drivers/net/tap/tap.h b/drivers/net/tap/tap.h > > new file mode 100644 > > index 000000000000..88f62b895feb > > --- /dev/null > > +++ b/drivers/net/tap/tap.h > > @@ -0,0 +1,73 @@ > > +/*- > > + * BSD LICENSE > > + * > > + * Copyright 2017 6WIND S.A. > > + * Copyright 2017 Mellanox. > > + * > > + * Redistribution and use in source and binary forms, with or > > without > > + * modification, are permitted provided that the following > > conditions > > + * are met: > > + * > > + * * Redistributions of source code must retain the above > > copyright > > + * notice, this list of conditions and the following > > disclaimer. > > + * * Redistributions in binary form must reproduce the above > > copyright > > + * notice, this list of conditions and the following > > disclaimer in > > + * the documentation and/or other materials provided with the > > + * distribution. > > + * * Neither the name of 6WIND S.A. nor the names of its > > + * contributors may be used to endorse or promote products > > derived > > + * from this software without specific prior written > > permission. > > + * > > + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > > CONTRIBUTORS > > + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT > > NOT > > + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND > > FITNESS FOR > > + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > > COPYRIGHT > > + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > > INCIDENTAL, > > + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > > NOT > > + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS > > OF USE, > > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED > > AND ON ANY > > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, > > OR TORT > > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF > > THE USE > > + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH > > DAMAGE. > > + */ > > + > > +#ifndef _TAP_H_ > > +#define _TAP_H_ > > + > > +#include > > + > > +#include > > +#include > > + > > +#define RTE_PMD_TAP_MAX_QUEUES 16 > > + > > +struct pkt_stats { > > + uint64_t opackets; /* Number of output packets */ > > + uint64_t ipackets; /* Number of input packets */ > > + uint64_t obytes; /* Number of bytes on output */ > > + uint64_t ibytes; /* Number of bytes on input */ > > + uint64_t errs; /* Number of error packets */ > > +}; > > + > > +struct rx_queue { > > + struct rte_mempool *mp; /* Mempool for RX packets */ > > + uint16_t in_port; /* Port ID */ > > + int fd; > > + struct pkt_stats stats; /* Stats for this RX queue */ > > +}; > > + > > +struct tx_queue { > > + int fd; > > + struct pkt_stats stats; /* Stats for this TX queue */ > > +}; > > + > > +struct pmd_internals { > > + char name[RTE_ETH_NAME_MAX_LEN]; /* Internal Tap device > > name */ > > + uint16_t nb_queues; /* Number of queues supported */ > > + struct ether_addr eth_addr; /* Mac address of the device > > port */ > > + int if_index; /* IF_INDEX for the port */ > > + struct rx_queue rxq[RTE_PMD_TAP_MAX_QUEUES]; /* List of RX > > queues */ > > + struct tx_queue txq[RTE_PMD_TAP_MAX_QUEUES]; /* List of TX > > queues */ +}; > > I guess I am going to be a bit picky here on the formatting. Moving > the code from .c to .h you compress a lot of white space out and now > I think it is very hard to read. Can you add back some of the white > space for readability. > Do you mean whitespaces between ";" and the comment, or do you mean line jumps? Would you rather have it look like what's described there? http://dpdk.org/doc/guides/contributing/coding_style.html#structure-declarations Regards, Pascal > > + > > +#endif /* _TAP_H_ */ > > -- > > 2.8.0.rc0 > > > > Regards, > Keith >