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 89CB2A09FD; Fri, 18 Dec 2020 18:19:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7530CAF1; Fri, 18 Dec 2020 18:19:09 +0100 (CET) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by dpdk.org (Postfix) with ESMTP id E410FCADA for ; Fri, 18 Dec 2020 18:19:07 +0100 (CET) Received: by mail-pg1-f180.google.com with SMTP id w5so1737004pgj.3 for ; Fri, 18 Dec 2020 09:19:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rea7uzlkvlDDOGHXJ8yKf9w2NxYhKDG5Y4GBmLkTjYk=; b=fLw5cuh4klJzVM/Lli2mWp3WwaGEO6ua3mp1PS0zmVmV0p/W7bC8BRJilfhFbivT2R efGq8PTHDeRRmUO2iBkmGvRmjv/1dnEBkHo76ov9m7gzfiPBxnxToUMtUy5OD7VWby4v HI8KKiTL06NaHLa72+jXr+MTKxpaWPLwDGY9Kj51w+KklToJ/INEj+t9ImHrLSI7y6eF hqYhrdVWTHv37TVd0qoGMtJIJRYgkOSLgVVK5hSXX7Qt5YnQKKNLJloJ5CD4ai1HaU6Y 6ItjestLWuJ2BdThIBU3pGjJRntpEc+inbeAuM/tO9Qb0FprM31RZ4p9IWV36QDqqrdF ij9Q== 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:mime-version:content-transfer-encoding; bh=Rea7uzlkvlDDOGHXJ8yKf9w2NxYhKDG5Y4GBmLkTjYk=; b=ctWB8scsFASb+tYLQHE1HnhS/fW3R+zzo8Kez/e2fI7rKDVLmLhtC2+c0E0JyPqMEf Tae3hecSsGe/wz2pJj/MX0qCIQ2NeMEMK0H6YrkaoUmSK1RMUearLwFSLA2/8knf6Y6e XGghvhD8JbIazKyOYfjdW3D0WP5t1SFj79OoI1P0/xeti4T/WBD/lZPvaOjlUl/sDsDR gKNaMEUkgy9uJ5ngP9ETkM2k5Vq6LlwGE+aINFDcLsgcLvl4e7F7OhKMmvZ6MT3K6rZL vt6s7POCzgzHYJsZG4VVRu2wWfalEKbZve/4/Ay6C/TqReI8V0TwS7zOSwVYmPs2TBSK 24Xw== X-Gm-Message-State: AOAM533axbzAfcpFLysaQ53si3zjIkLUcHqwqR+mRp1jd7YA3RnwHKft xXc4yS3irLwC9WlbFiT2bItVnQ== X-Google-Smtp-Source: ABdhPJwPCXvkoB6724IrhKxuBGB3PjKS4PVpMbgF3lGatrynZt/9ZtA85LA6FG0inSBkKZdHyd28TA== X-Received: by 2002:a62:8050:0:b029:19d:e8b4:ba1 with SMTP id j77-20020a6280500000b029019de8b40ba1mr5117889pfd.69.1608311946085; Fri, 18 Dec 2020 09:19:06 -0800 (PST) Received: from hermes.local (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id i7sm9403677pfc.50.2020.12.18.09.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 09:19:05 -0800 (PST) Date: Fri, 18 Dec 2020 09:17:56 -0800 From: Stephen Hemminger To: Chenbo Xia Cc: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com, cunming.liang@intel.com, xiuchun.lu@intel.com, miao.li@intel.com, jingjing.wu@intel.com Message-ID: <20201218091756.6f0f67be@hermes.local> In-Reply-To: <20201218073851.93609-2-chenbo.xia@intel.com> References: <20201218073851.93609-1-chenbo.xia@intel.com> <20201218073851.93609-2-chenbo.xia@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 1/9] lib: introduce vfio-user library 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 Fri, 18 Dec 2020 15:38:43 +0800 Chenbo Xia wrote: > +typedef struct vfio_user_msg { > + uint16_t msg_id; > + uint16_t cmd; > + uint32_t size; > +#define VFIO_USER_TYPE_CMD (0x0) /* Message type is COMMAND */ > +#define VFIO_USER_TYPE_REPLY (0x1 << 0) /* Message type is REPLY */ > +#define VFIO_USER_NEED_NO_RP (0x1 << 4) /* Message needs no reply */ > +#define VFIO_USER_ERROR (0x1 << 5) /* Reply message has error */ > + uint32_t flags; > + uint32_t err; /* Valid in reply, optional */ > + union { > + struct vfio_user_version ver; > + } payload; > + int fds[VFIO_USER_MAX_FD]; > + int fd_num; > +} __attribute((packed)) VFIO_USER_MSG; Please don't introduce all capitals typedefs. Don't use packed, it generates slower code. Better to use tools like pahole and make the layout of the structure naturally packed. Also, if you put fds[] at the end you could use dynamic sized array and not be constrained by VFIO_USER_MAX_FD. Since this is DPDK library the symbols should all start with rte_