From: "Tan, Jianfeng" <jianfeng.tan@intel.com>
To: Jason Wang <jasowang@redhat.com>, dev@dpdk.org
Cc: yuanhan.liu@linux.intel.com, ferruh.yigit@intel.com,
cunming.liang@intel.com
Subject: Re: [dpdk-dev] [PATCH v2 5/7] net/virtio_user: add vhost kernel support
Date: Wed, 11 Jan 2017 11:13:09 +0800 [thread overview]
Message-ID: <b82e84e0-7412-6928-529e-51072491af4a@intel.com> (raw)
In-Reply-To: <fd33abf3-3daf-4963-5ab3-018ebe6c4a67@redhat.com>
On 1/11/2017 10:42 AM, Jason Wang wrote:
>
>
> On 2017年01月10日 14:11, Tan, Jianfeng wrote:
>>
>> Hi Jason,
>>
>>
>> On 1/9/2017 12:39 PM, Jason Wang wrote:
>>>
>>>
>>> On 2016年12月23日 15:14, Jianfeng Tan wrote:
>>>> This patch add support vhost kernel as the backend for virtio_user.
>>>> Three main hook functions are added:
>>>> - vhost_kernel_setup() to open char device, each vq pair needs one
>>>> vhostfd;
>>>> - vhost_kernel_ioctl() to communicate control messages with vhost
>>>> kernel module;
>>>> - vhost_kernel_enable_queue_pair() to open tap device and set it
>>>> as the backend of corresonding vhost fd (that is to say, vq
>>>> pair).
>>>>
>>>> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
>>>> ---
>>>>
>> [...]
>>>> +/* TUNSETIFF ifr flags */
>>>> +#define IFF_TAP 0x0002
>>>> +#define IFF_NO_PI 0x1000
>>>> +#define IFF_ONE_QUEUE 0x2000
>>>> +#define IFF_VNET_HDR 0x4000
>>>> +#define IFF_MULTI_QUEUE 0x0100
>>>> +#define IFF_ATTACH_QUEUE 0x0200
>>>> +#define IFF_DETACH_QUEUE 0x0400
>>>
>>> Do we really want to duplicate those things which has been exposed
>>> by uapi here?
>>
>> You mean those defined in <linux/if_tun.h>? Redefine those common
>> macros, or include standard header file, with respective pros and
>> cons. DPDK prefers the redefinition way as far as I understand,
>> doesn't it?
>>
>
> Well, if you really want to do this, you may want to use an
> independent file. Then you can sync it with linux headers with a bash
> script.
Agreed!
[...]
>>>> +static struct vhost_memory_kernel *
>>>> +prepare_vhost_memory_kernel(void)
>>>> +{
>>>> + uint32_t i, j, k = 0;
>>>> + struct rte_memseg *seg;
>>>> + struct vhost_memory_region *mr;
>>>> + struct vhost_memory_kernel *vm;
>>>> +
>>>> + vm = malloc(sizeof(struct vhost_memory_kernel) +
>>>> + VHOST_KERNEL_MAX_REGIONS *
>>>> + sizeof(struct vhost_memory_region));
>>>> +
>>>> + for (i = 0; i < RTE_MAX_MEMSEG; ++i) {
>>>> + seg = &rte_eal_get_configuration()->mem_config->memseg[i];
>>>> + if (!seg->addr)
>>>> + break;
>>>
>>> If we're sure the number of regions is less than 64(or the module
>>> parameter read from /sys), can we avoid the iteration here?
>>
>> The "if" statement under the "for" statement can save us from all
>> RTE_MAX_MEMSEG iteration.
>
> But if we know the number of regions is short than the limit, there's
> even no need for this?
The problem is: we don't have a variable to know how many segments are
there in DPDK. Anyway, we need to report error in the situation that #
of segments > # of regions. Or can you give a more specific example?
[...]
>>>> + if (dev->ifname)
>>>> + strncpy(ifr.ifr_name, dev->ifname, IFNAMSIZ);
>>>> + else
>>>> + strncpy(ifr.ifr_name, "tap%d", IFNAMSIZ);
>>>> + if (ioctl(tapfd, TUNSETIFF, (void *)&ifr) == -1) {
>>>> + PMD_DRV_LOG(ERR, "TUNSETIFF failed: %s", strerror(errno));
>>>> + goto error;
>>>> + }
>>>
>>> This requires CAP_NET_ADMIN, so we should really consider to accept
>>> a pre-created fd here.
>>
>> It sounds like a future work for me. So far, all DPDK apps are
>> running in privileged mode (including CAP_NET_ADMIN?).
>>
>
> That's not safe.
Yes.
> Accepting a per-created fd can solve this, and can even support macvtap
So you are proposing a way to specify the virtio_user parameter like,
--vdev=virtio_user,tapfd=fd1,xxx, right? As replied in your another
comment, it's a great way to go. But I'm afraid we have no time to
implement that in this cycle.
Thanks,
Jianfeng
next prev parent reply other threads:[~2017-01-11 3:13 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-02 14:31 [dpdk-dev] [PATCH 0/3] virtio_user as an alternative exception path Jianfeng Tan
2016-12-02 14:31 ` [dpdk-dev] [PATCH 1/3] net/virtio_user: add vhost layer Jianfeng Tan
2016-12-08 7:21 ` Yuanhan Liu
2016-12-02 14:31 ` [dpdk-dev] [PATCH 2/3] net/virtio_user: add vhost kernel support Jianfeng Tan
2016-12-02 14:31 ` [dpdk-dev] [PATCH 3/3] net/virtio_user: fix wrongly set features Jianfeng Tan
2016-12-08 8:32 ` Yuanhan Liu
2016-12-02 14:44 ` [dpdk-dev] [PATCH 0/3] virtio_user as an alternative exception path Thomas Monjalon
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 0/7] " Jianfeng Tan
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 1/7] net/virtio_user: fix wrongly set features Jianfeng Tan
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 2/7] net/virtio_user: postpone DRIVER OK notification Jianfeng Tan
[not found] ` <20161226062719.GA19288@yliu-dev.sh.intel.com>
2016-12-26 6:55 ` Tan, Jianfeng
2016-12-26 8:02 ` Yuanhan Liu
2016-12-26 8:26 ` Tan, Jianfeng
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 3/7] net/virtio_user: move vhost user specific code Jianfeng Tan
2016-12-26 6:28 ` Yuanhan Liu
2016-12-26 6:58 ` Tan, Jianfeng
2016-12-26 7:57 ` Yuanhan Liu
2016-12-29 9:40 ` Tan, Jianfeng
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 4/7] net/virtio_user: abstract virtio user backend ops Jianfeng Tan
2016-12-26 6:41 ` Yuanhan Liu
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 5/7] net/virtio_user: add vhost kernel support Jianfeng Tan
2016-12-26 7:44 ` Yuanhan Liu
2017-01-04 7:22 ` Tan, Jianfeng
2017-01-04 7:46 ` Yuanhan Liu
2017-01-09 4:51 ` Jason Wang
2017-01-09 4:39 ` Jason Wang
2017-01-10 6:11 ` Tan, Jianfeng
2017-01-10 8:46 ` Thomas Monjalon
2017-01-10 9:11 ` Tan, Jianfeng
2017-01-11 2:42 ` Jason Wang
2017-01-11 3:13 ` Tan, Jianfeng [this message]
2017-01-11 3:23 ` Jason Wang
2017-01-12 9:40 ` Tan, Jianfeng
2017-01-13 2:27 ` Jason Wang
2017-01-11 2:30 ` Tan, Jianfeng
2017-01-11 2:45 ` Jason Wang
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 6/7] net/virtio_user: enable offloading Jianfeng Tan
2016-12-26 7:53 ` Yuanhan Liu
2016-12-23 7:14 ` [dpdk-dev] [PATCH v2 7/7] net/virtio_user: enable multiqueue with vhost kernel Jianfeng Tan
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 0/7] virtio_user as an alternative exception path Jianfeng Tan
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 1/7] net/virtio_user: fix wrongly set features Jianfeng Tan
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 2/7] net/virtio_user: fix not properly reset device Jianfeng Tan
2017-01-04 5:46 ` Yuanhan Liu
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 3/7] net/virtio_user: move vhost user specific code Jianfeng Tan
2017-01-04 6:02 ` Yuanhan Liu
2017-01-04 6:46 ` Tan, Jianfeng
2017-01-04 7:08 ` Yuanhan Liu
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 4/7] net/virtio_user: abstract virtio user backend ops Jianfeng Tan
2017-01-04 6:11 ` Yuanhan Liu
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 5/7] net/virtio_user: add vhost kernel support Jianfeng Tan
2017-01-04 6:13 ` Yuanhan Liu
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 6/7] net/virtio_user: enable offloading Jianfeng Tan
2017-01-04 3:59 ` [dpdk-dev] [PATCH v3 7/7] net/virtio_user: enable multiqueue with vhost kernel Jianfeng Tan
2017-01-09 14:06 ` [dpdk-dev] [PATCH v3 0/7] virtio_user as an alternative exception path Bruce Richardson
2017-01-10 8:46 ` Tan, Jianfeng
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 0/8] " Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 1/8] net/virtio_user: fix wrongly get/set features Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 2/8] net/virtio_user: fix not properly reset device Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 3/8] net/virtio_user: move vhost user specific code Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 4/8] net/virtio_user: abstract virtio user backend ops Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 5/8] net/virtio_user: add vhost kernel support Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 6/8] net/virtio_user: enable offloading Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 7/8] net/virtio_user: enable multiqueue with vhost kernel Jianfeng Tan
2017-01-13 12:18 ` [dpdk-dev] [PATCH v4 8/8] doc: add guide to use virtio_user as exceptional path Jianfeng Tan
2017-01-16 6:00 ` Yuanhan Liu
2017-01-16 6:04 ` Yuanhan Liu
2017-01-16 9:44 ` Thomas Monjalon
2017-01-16 9:49 ` Yuanhan Liu
2017-01-16 14:45 ` Thomas Monjalon
2017-01-22 0:46 ` Aws Ismail
2017-01-22 7:16 ` Tan, Jianfeng
2017-01-16 15:05 ` [dpdk-dev] [PATCH v4 0/8] virtio_user as an alternative exception path Yuanhan Liu
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=b82e84e0-7412-6928-529e-51072491af4a@intel.com \
--to=jianfeng.tan@intel.com \
--cc=cunming.liang@intel.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jasowang@redhat.com \
--cc=yuanhan.liu@linux.intel.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).