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 538CEA09D3; Thu, 12 Nov 2020 10:37:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 351FE5953; Thu, 12 Nov 2020 10:37:09 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id E77F05937 for ; Thu, 12 Nov 2020 10:37:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605173826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=c1JwGTU03nBIjFUAKZkiLcXlwNMnAR+eMab83evaZYU=; b=idweTXHL3tcWRDyAu/OM/ud7Fo27SYDBwe48lYbA8IWTV0b0Tz/FzmvT+vWqLBTFAL1gUd geyRD6Rsu49DxbQjV7oV7Pkki+zj71QiEEzNYMClzHv6xsM/U4CWiwAeLJMg0LcHXPmuKd ERYgRo1CarR3F+hAY9AmZfI7kUc0fLk= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-w_GxY38_Plm9vJesw_lSfw-1; Thu, 12 Nov 2020 04:37:03 -0500 X-MC-Unique: w_GxY38_Plm9vJesw_lSfw-1 Received: by mail-vs1-f71.google.com with SMTP id s11so338453vsq.13 for ; Thu, 12 Nov 2020 01:37:02 -0800 (PST) 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=c1JwGTU03nBIjFUAKZkiLcXlwNMnAR+eMab83evaZYU=; b=AUFM0DkaREZcfempQwt7AIgCD8c4shfIYktk9qWHPbUKQ4w0r7CTOavLl9ayplfVQ2 c4leLIau3M0dpXnvoSIKpRpvzQaA9qaeq20vmOiC57VR90RlpUG6vyC+H3UaXQXlnKtC X+5Ow0aa/MRAiGVXUlOOpiYv7lxmAWTEpNj7qqSntrt9jlniGGYadrrof6JYRNdZXwzt MKGdkkmbAM+jxIq97QCQuOYWxAvrxe407I71mxG6bZ0LfjKb4mfomYsfnEFyVrKdyX2z 3PRX0J5BOXqJnWwqZcqg/yfRKhzcONmRYzH11Zu0vV0daW0D82uDvWbF4TR9/avTT3d8 BNxw== X-Gm-Message-State: AOAM533nn95bSDdSLgNLq3QS5SWhTFj1NgOPLQ0NzKq78i8WTN0gJhzF ggiHJjmkhx8de0xzAsyMsMMjk+ma8HsNu2iroMPXniv8fHA/lufeY0i+uf1DneKd8I0i0E25WHr a2HIYM+AbJ/QUN1XcLoM= X-Received: by 2002:a1f:23d6:: with SMTP id j205mr15499007vkj.20.1605173822371; Thu, 12 Nov 2020 01:37:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUyvJzHchUd9TGlt4nH2p9pUV8N4mEPkpbU5GQ34atc2NOAjkh6E0EnjIJr/YfobLGTHcshEOYJ/GwWthh+Oo= X-Received: by 2002:a1f:23d6:: with SMTP id j205mr15499000vkj.20.1605173822179; Thu, 12 Nov 2020 01:37:02 -0800 (PST) MIME-Version: 1.0 References: <20201111111957.46090-1-Cheng1.jiang@intel.com> <20201112072147.4345-1-Cheng1.jiang@intel.com> In-Reply-To: <20201112072147.4345-1-Cheng1.jiang@intel.com> From: David Marchand Date: Thu, 12 Nov 2020 10:36:50 +0100 Message-ID: To: Cheng Jiang Cc: Maxime Coquelin , "Xia, Chenbo" , dev , "Fu, Patrick" , "Yang, YvonneX" , Jiayu Hu Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v3] examples/vhost: fix ioat dependency issue 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 Thu, Nov 12, 2020 at 8:30 AM Cheng Jiang wrote: > > Fix vhost-switch compiling issue when ioat dependency is missing. > Change 'RTE_x86' check into 'RTE_RAW_IOAT' check in meson build file > and update Makefile. Clean some codes. > > Fixes: abec60e7115d ("examples/vhost: support vhost async data path") > Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing") > > Signed-off-by: Cheng Jiang > --- > v3: > * Added fixes lines in commit log. > > v2: > * Cleaned some codes > * Changed RTE_RAW_IOAT check method in Makefile > * Added ioat function definition when RTE_RAW_IOAT is missing > > examples/vhost/Makefile | 5 +++++ > examples/vhost/ioat.h | 32 +++++++++++++++++++++++++------- > examples/vhost/main.c | 22 +++++++++++----------- > examples/vhost/meson.build | 2 +- > 4 files changed, 42 insertions(+), 19 deletions(-) > > diff --git a/examples/vhost/Makefile b/examples/vhost/Makefile > index cec59d0e0..cbe56f742 100644 > --- a/examples/vhost/Makefile > +++ b/examples/vhost/Makefile > @@ -28,6 +28,11 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) > LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk) > LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk) > > +HAS_RAW_IOAT=$(shell echo RTE_RAW_IOAT | $(CPP) $(CFLAGS) -P - | tail -1) > +ifeq ($(HAS_RAW_IOAT), 1) > +SRCS-y += ioat.c > +endif > + > CFLAGS += -DALLOW_EXPERIMENTAL_API > > build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build > diff --git a/examples/vhost/ioat.h b/examples/vhost/ioat.h > index 9664fcc3a..d6e1e2e07 100644 > --- a/examples/vhost/ioat.h > +++ b/examples/vhost/ioat.h > @@ -24,14 +24,8 @@ struct dma_for_vhost { > uint16_t nr; > }; > > -#ifdef RTE_ARCH_X86 > +#ifdef RTE_RAW_IOAT > int open_ioat(const char *value); > -#else > -static int open_ioat(const char *value __rte_unused) > -{ > - return -1; > -} > -#endif > > uint32_t > ioat_transfer_data_cb(int vid, uint16_t queue_id, > @@ -42,4 +36,28 @@ uint32_t > ioat_check_completed_copies_cb(int vid, uint16_t queue_id, > struct rte_vhost_async_status *opaque_data, > uint16_t max_packets); > +#else > +static int open_ioat(const char *value __rte_unused) > +{ > + return -1; > +} > + > +static uint32_t > +ioat_transfer_data_cb(int vid __rte_unused, uint16_t queue_id __rte_unused, > + struct rte_vhost_async_desc *descs __rte_unused, > + struct rte_vhost_async_status *opaque_data __rte_unused, > + uint16_t count __rte_unused) > +{ > + return -1; > +} > + > +static uint32_t > +ioat_check_completed_copies_cb(int vid __rte_unused, > + uint16_t queue_id __rte_unused, > + struct rte_vhost_async_status *opaque_data __rte_unused, > + uint16_t max_packets __rte_unused) > +{ > + return -1; > +} > +#endif > #endif /* _IOAT_H_ */ > diff --git a/examples/vhost/main.c b/examples/vhost/main.c > index 59a1aff07..4dc6102ab 100644 > --- a/examples/vhost/main.c > +++ b/examples/vhost/main.c > @@ -1294,13 +1294,6 @@ new_device(int vid) > int lcore, core_add = 0; > uint32_t device_num_min = num_devices; > struct vhost_dev *vdev; > - > - struct rte_vhost_async_channel_ops channel_ops = { > - .transfer_data = ioat_transfer_data_cb, > - .check_completed_copies = ioat_check_completed_copies_cb > - }; > - struct rte_vhost_async_features f; > - > vdev = rte_zmalloc("vhost device", sizeof(*vdev), RTE_CACHE_LINE_SIZE); > if (vdev == NULL) { > RTE_LOG(INFO, VHOST_DATA, > @@ -1342,10 +1335,17 @@ new_device(int vid) > vid, vdev->coreid); > > if (async_vhost_driver) { > - f.async_inorder = 1; > - f.async_threshold = 256; > - return rte_vhost_async_channel_register(vid, VIRTIO_RXQ, > - f.intval, &channel_ops); > + struct rte_vhost_async_features f; > + struct rte_vhost_async_channel_ops channel_ops; > + if (strncmp(dma_type, "ioat", 4) == 0) { > + channel_ops.transfer_data = ioat_transfer_data_cb; > + channel_ops.check_completed_copies = > + ioat_check_completed_copies_cb; > + f.async_inorder = 1; > + f.async_threshold = 256; > + return rte_vhost_async_channel_register(vid, VIRTIO_RXQ, > + f.intval, &channel_ops); > + } > } > > return 0; > diff --git a/examples/vhost/meson.build b/examples/vhost/meson.build > index 24f1f7131..d5388a795 100644 > --- a/examples/vhost/meson.build > +++ b/examples/vhost/meson.build > @@ -15,7 +15,7 @@ sources = files( > 'main.c', 'virtio_net.c' > ) > > -if dpdk_conf.has('RTE_ARCH_X86') > +if dpdk_conf.has('RTE_RAW_IOAT') > deps += 'raw_ioat' > sources += files('ioat.c') > endif > -- > 2.29.2 > I'll let Bruce and Maxime have the last word on this patch. But at least it works for me, Tested-by: David Marchand -- David Marchand