From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Jakub Grajciar <jgrajcia@cisco.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [RFC v9] /net: memory interface (memif)
Date: Wed, 29 May 2019 18:29:04 +0100 [thread overview]
Message-ID: <af33d828-8bb0-61aa-4bfe-3ee795dbccfa@intel.com> (raw)
In-Reply-To: <20190520101841.17708-1-jgrajcia@cisco.com>
On 5/20/2019 11:18 AM, Jakub Grajciar wrote:
> Memory interface (memif), provides high performance
> packet transfer over shared memory.
Can you please update the patch title as following in next version:
net/memif: introduce memory interface (memif) PMD
Can you please drop the RFC from next version, the patch is mature enough and we
can start regular versioning on it (without RFC), and RFC tag prefent DPDK
community lab to process the patch, so dropping the RFC will help there.
>
> Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
<...>
> +
> +.. csv-table:: **Memif configuration options**
> + :header: "Option", "Description", "Default", "Valid value"
> +
> + "id=0", "Used to identify peer interface", "0", "uint32_t"
> + "role=master", "Set memif role", "slave", "master|slave"
> + "bsize=1024", "Size of single packet buffer", "2048", "uint16_t"
What happens is 'bsize < mbuf size'? I didn't see any check in the code but is
there any assumption around this?
Or any assumption that slave and master packet should be same? Or any other
relation?
If there is any assumption it may be good to add checks to the code and document
here.
> + "rsize=11", "Log2 of ring size. If rsize is 10, actual ring size is 1024", "10", "1-14"
> + "nrxq=2", "Number of RX queues", "1", "255"
> + "ntxq=2", "Number of TX queues", "1", "255"
> + "socket=/tmp/memif.sock", "Socket filename", "/tmp/memif.sock", "string len 256"
> + "mac=01:23:45:ab:cd:ef", "Mac address", "01:ab:23:cd:45:ef", ""
> + "secret=abc123", "Secret is an optional security option, which if specified, must be matched by peer", "", "string len 24"
> + "zero-copy=yes", "Enable/disable zero-copy slave mode", "no", "yes|no"
> +
<...>
> +Example: testpmd and testpmd
> +----------------------------
> +In this example we run two instances of testpmd application and transmit packets over memif.
> +
> +First create ``master`` interface::
> +
> + #./testpmd -l 0-1 --proc-type=primary --file-prefix=pmd1 --vdev=net_memif,role=master -- -i
> +
> +Now create ``slave`` interface (master must be already running so the slave will connect)::
> +
> + #./testpmd -l 2-3 --proc-type=primary --file-prefix=pmd2 --vdev=net_memif -- -i
> +
> +Set forwarding mode in one of the instances to 'rx only' and the other to 'tx only'::
> +
> + testpmd> set fwd rxonly
> + testpmd> start
> +
> + testpmd> set fwd txonly
> + testpmd> start
Also following works, above sample was not clear for me if the shared buffer is
only for one direction communication, but it is not the case, you can consider
adding below as well to clarify this:
Slave:
testpmd> start
Master:
testpmd> start tx_first
And if you want you can add multiple queue sample too, which gives better
performance:
master:
./testpmd -l 0-1 --proc-type=primary --file-prefix=pmd1
--vdev=net_memif,role=master -- -i --rxq=4 --txq=4
slave:
./testpmd -l 2-3 --proc-type=primary --file-prefix=pmd2
--vdev=net_memif,role=slave -- -i --rxq=4 --txq=4
<...>
> +LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool
> +LDLIBS += -lrte_ethdev -lrte_kvargs
> +LDLIBS += -lrte_hash
Requires to be linked against vdev bus library for shared build:
LDLIBS += -lrte_bus_vdev
Can you please be sure to that PMD can be compiled as shared library?
<...>
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright 2018-2019 Cisco Systems, Inc. All rights reserved.
> +
> +if host_machine.system() != 'linux'
> + build = false
> +endif
> +
> +sources = files('rte_eth_memif.c',
> + 'memif_socket.c')
> +
> +allow_experimental_apis = true
Can you please list the used experimental APIs here in a commented way, as it is
done in Makefile?
<...>
> +static void
> +memif_dev_close(struct rte_eth_dev *dev)
> +{
> + struct pmd_internals *pmd = dev->data->dev_private;
> +
> + memif_msg_enq_disconnect(pmd->cc, "Device closed", 0);
> + memif_disconnect(dev);
> +
> + memif_socket_remove_device(dev);
On latest agreement, .dev_close should free all internal data structures, and
since 'RTE_ETH_DEV_CLOSE_REMOVE' flag is set, generic ones will be cleaned by API.
Please check what is clean by API from 'rte_eth_dev_release_port()' remaining
memmory allocated by PMD should be freed here (rx, tx queues for example)
<...>
> + /* TX stats */
> + for (i = 0; i < nq; i++) {
> + mq = dev->data->tx_queues[i];
> + stats->q_opackets[i] = mq->n_pkts;
> + stats->q_obytes[i] = mq->n_bytes;
> + stats->q_errors[i] = mq->n_err;
'q_errors' is for Rx, there is a patchset on top of the next-net head, right now
this value only incorporate to overall Tx error stats (oerrors) not in this field.
<...>
> +
> + eth_dev->data->dev_flags &= RTE_ETH_DEV_CLOSE_REMOVE;
Are you sure you want to '&' this flag, shouldn't it be "|="?
<...>
> +/* check if directory exists and if we have permission to read/write */
> +static int
> +memif_check_socket_filename(const char *filename)
> +{
> + char *dir = NULL, *tmp;
> + uint32_t idx;
> + int ret = 0;
> +
> + tmp = strrchr(filename, '/');
> + if (tmp != NULL) {
> + idx = tmp - filename;
> + dir = rte_zmalloc("memif_tmp", sizeof(char) * (idx + 1), 0);
> + if (dir == NULL) {
> + MIF_LOG(ERR, "Failed to allocate memory.");
> + return -1;
> + }
> + strlcpy(dir, filename, sizeof(char) * (idx + 1));
> + }
> +
> + if (dir == NULL || (faccessat(-1, dir, F_OK | R_OK |
> + W_OK, AT_EACCESS) < 0)) {
> + MIF_LOG(ERR, "Invalid directory: '%s'.", dir);
Getting following build error from "gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1)":
In file included from .../dpdk/drivers/net/memif/rte_eth_memif.c:27:
In function ‘memif_check_socket_filename’,
inlined from ‘memif_set_socket_filename’ at
.../dpdk/drivers/net/memif/rte_eth_memif.c:1052:9:
.../dpdk/drivers/net/memif/rte_eth_memif.h:35:2: error: ‘%s’ directive argument
is null [-Werror=format-overflow=]
35 | rte_log(RTE_LOG_ ## level, memif_logtype, \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36 | "%s(): " fmt "\n", __func__, ##args)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../dpdk/drivers/net/memif/rte_eth_memif.c:1035:3: note: in expansion of macro
‘MIF_LOG’
1035 | MIF_LOG(ERR, "Invalid directory: '%s'.", dir);
| ^~~~~~~
.../dpdk/drivers/net/memif/rte_eth_memif.c: In function ‘memif_set_socket_filename’:
.../dpdk/drivers/net/memif/rte_eth_memif.c:1098:37: note: format string is
defined here
1098 | MIF_LOG(INFO, "Initialize MEMIF: %s.", name);
<...>
> +static int
> +memif_set_mac(const char *key __rte_unused, const char *value, void *extra_args)
> +{
> + struct ether_addr *ether_addr = (struct ether_addr *)extra_args;
Can you please rebase next version on top of latest head, which got some patches
that are adding rte_ prefix to these structs.
<...>
> +#ifndef _RTE_ETH_MEMIF_H_
> +#define _RTE_ETH_MEMIF_H_
> +
> +#ifndef _GNU_SOURCE
> +#define _GNU_SOURCE
> +#endif /* GNU_SOURCE */
Why this was required?
next prev parent reply other threads:[~2019-05-29 17:29 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-13 13:30 [dpdk-dev] [RFC v3] " Jakub Grajciar
2018-12-13 18:07 ` Stephen Hemminger
2018-12-14 9:39 ` Bruce Richardson
2018-12-14 16:12 ` Wiles, Keith
2019-01-04 17:16 ` Ferruh Yigit
2019-01-04 19:23 ` Stephen Hemminger
2019-01-04 19:27 ` Stephen Hemminger
2019-01-04 19:32 ` Stephen Hemminger
2019-02-20 11:52 ` [dpdk-dev] [RFC v4] " Jakub Grajciar
2019-02-20 15:46 ` Stephen Hemminger
2019-02-20 16:17 ` Stephen Hemminger
2019-02-21 10:50 ` Rami Rosen
2019-02-27 17:04 ` Ferruh Yigit
2019-03-22 11:57 ` [dpdk-dev] [RFC v5] " Jakub Grajciar
2019-03-22 11:57 ` Jakub Grajciar
2019-03-25 20:58 ` Ferruh Yigit
2019-03-25 20:58 ` Ferruh Yigit
2019-05-02 12:35 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-05-02 12:35 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-05-03 4:27 ` Honnappa Nagarahalli
2019-05-03 4:27 ` Honnappa Nagarahalli
2019-05-06 11:00 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-05-06 11:00 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-05-06 11:04 ` Damjan Marion (damarion)
2019-05-06 11:04 ` Damjan Marion (damarion)
2019-05-07 11:29 ` Honnappa Nagarahalli
2019-05-07 11:29 ` Honnappa Nagarahalli
2019-05-07 11:37 ` Damjan Marion (damarion)
2019-05-07 11:37 ` Damjan Marion (damarion)
2019-05-08 7:53 ` Honnappa Nagarahalli
2019-05-08 7:53 ` Honnappa Nagarahalli
2019-05-09 8:30 ` [dpdk-dev] [RFC v6] " Jakub Grajciar
2019-05-09 8:30 ` Jakub Grajciar
2019-05-13 10:45 ` [dpdk-dev] [RFC v7] " Jakub Grajciar
2019-05-13 10:45 ` Jakub Grajciar
2019-05-16 11:46 ` [dpdk-dev] [RFC v8] " Jakub Grajciar
2019-05-16 15:18 ` Stephen Hemminger
2019-05-16 15:19 ` Stephen Hemminger
2019-05-16 15:21 ` Stephen Hemminger
2019-05-20 9:22 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-05-16 15:25 ` Stephen Hemminger
2019-05-16 15:28 ` Stephen Hemminger
2019-05-20 10:18 ` [dpdk-dev] [RFC v9] " Jakub Grajciar
2019-05-29 17:29 ` Ferruh Yigit [this message]
2019-05-30 12:38 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-05-31 6:22 ` [dpdk-dev] [PATCH v10] net/memif: introduce memory interface (memif) PMD Jakub Grajciar
2019-05-31 7:43 ` Ye Xiaolong
2019-06-03 11:28 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-06-03 14:25 ` Ye Xiaolong
2019-06-05 12:01 ` Ferruh Yigit
2019-06-03 13:37 ` Aaron Conole
2019-06-05 11:55 ` Ferruh Yigit
2019-06-06 9:24 ` Ferruh Yigit
2019-06-06 10:25 ` Jakub Grajciar -X (jgrajcia - PANTHEON TECHNOLOGIES at Cisco)
2019-06-06 11:18 ` Ferruh Yigit
2019-06-06 8:24 ` [dpdk-dev] [PATCH v11] " Jakub Grajciar
2019-06-06 11:38 ` [dpdk-dev] [PATCH v12] " Jakub Grajciar
2019-06-06 14:07 ` 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=af33d828-8bb0-61aa-4bfe-3ee795dbccfa@intel.com \
--to=ferruh.yigit@intel.com \
--cc=dev@dpdk.org \
--cc=jgrajcia@cisco.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).