DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wiles, Keith" <keith.wiles@intel.com>
To: Pascal Mazon <pascal.mazon@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH 1/4] net/tap: move private elements to external header
Date: Fri, 3 Mar 2017 15:38:11 +0000	[thread overview]
Message-ID: <AD391E10-081C-441A-B8A3-3F96D4B1ADB3@intel.com> (raw)
In-Reply-To: <20743012cc151e3dfd30eff7ef0f6a03b75ac0c9.1488537600.git.pascal.mazon@6wind.com>


> On Mar 3, 2017, at 4:45 AM, Pascal Mazon <pascal.mazon@6wind.com> 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 <pascal.mazon@6wind.com>
> Acked-by: Olga Shern <olgas@mellanox.com>
> ---
> 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 <linux/if_ether.h>
> #include <fcntl.h>
> 
> +#include <tap.h>
> +
> /* 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 <inttypes.h>
> +
> +#include <rte_ethdev.h>
> +#include <rte_ether.h>
> +
> +#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.

> +
> +#endif /* _TAP_H_ */
> -- 
> 2.8.0.rc0
> 

Regards,
Keith

  reply	other threads:[~2017-03-03 15:38 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 10:45 [dpdk-dev] [PATCH 0/4] net/tap: support flow API Pascal Mazon
2017-03-03 10:45 ` [dpdk-dev] [PATCH 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-03 15:38   ` Wiles, Keith [this message]
2017-03-06 14:18     ` Pascal Mazon
2017-03-06 14:51       ` Wiles, Keith
2017-03-03 10:45 ` [dpdk-dev] [PATCH 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-03 10:45 ` [dpdk-dev] [PATCH 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-03 10:45 ` [dpdk-dev] [PATCH 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-03 15:47   ` Wiles, Keith
2017-03-06 14:22     ` Pascal Mazon
2017-03-03 15:54 ` [dpdk-dev] [PATCH 0/4] net/tap: support flow API Wiles, Keith
2017-03-06 17:05 ` [dpdk-dev] [PATCH v2 " Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-06 17:05   ` [dpdk-dev] [PATCH v2 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-07 15:05   ` [dpdk-dev] [PATCH v2 0/4] net/tap: support flow API Pascal Mazon
2017-03-07 15:08     ` Wiles, Keith
2017-03-07 16:35   ` [dpdk-dev] [PATCH v3 " Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-09 15:28       ` Ferruh Yigit
2017-03-10  9:40         ` Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-09 15:29       ` Ferruh Yigit
2017-03-10  9:39         ` Pascal Mazon
2017-03-07 16:35     ` [dpdk-dev] [PATCH v3 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-14  8:29   ` [dpdk-dev] [PATCH v4 0/4] net/tap: support flow API Pascal Mazon
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-14 14:05       ` Wiles, Keith
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-14 14:03       ` Wiles, Keith
2017-03-14  8:29     ` [dpdk-dev] [PATCH v4 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-15 14:54   ` [dpdk-dev] [PATCH v5 0/4] net/tap: support flow API Pascal Mazon
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-21 15:32       ` Wiles, Keith
2017-03-21 16:57         ` Pascal Mazon
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-21 15:35       ` Wiles, Keith
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-15 14:54     ` [dpdk-dev] [PATCH v5 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-21 17:10       ` Ferruh Yigit
2017-03-21 15:48     ` [dpdk-dev] [PATCH v5 0/4] net/tap: support flow API Wiles, Keith
2017-03-22  9:48   ` [dpdk-dev] [PATCH v6 " Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-22  9:48     ` [dpdk-dev] [PATCH v6 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-22 13:56       ` Ferruh Yigit
2017-03-22 14:22     ` [dpdk-dev] [PATCH v6 0/4] net/tap: support flow API Wiles, Keith
2017-03-23  8:33     ` [dpdk-dev] [PATCH v7 " Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 1/4] net/tap: move private elements to external header Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 2/4] net/tap: add preliminary support for rte_flow Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 3/4] net/tap: add netlink back-end for flow API Pascal Mazon
2017-03-23  8:33       ` [dpdk-dev] [PATCH v7 4/4] net/tap: add basic flow API patterns and actions Pascal Mazon
2017-03-23 12:50       ` [dpdk-dev] [PATCH v7 0/4] net/tap: support flow API Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AD391E10-081C-441A-B8A3-3F96D4B1ADB3@intel.com \
    --to=keith.wiles@intel.com \
    --cc=dev@dpdk.org \
    --cc=pascal.mazon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).