From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64685A0A02; Thu, 14 Jan 2021 10:26:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D36A141018; Thu, 14 Jan 2021 10:26:52 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id AA9F1141011 for ; Thu, 14 Jan 2021 10:26:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610616410; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ze/y2BkCGGfQo8cOs4yyCIj1sQoWMwkTW41eUvhiOB0=; b=gyzWYAv/PbWWnObD11TmaFUS81bra6mZZCU/sfLmDU7H48eW05p5fZH2E76saDngdXBkbL gQdgqjZllnprY2gJ2MR1+ypsgyfiprZnNAM8IG0Yks2TwiDAWmNHYUkVFuEzUOSSp7yVpa eqElgIoRi5Or5OIllvhgS0Z6wyMti6g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-225-jgb_VtI1NxuSMj29HlwsGw-1; Thu, 14 Jan 2021 04:26:48 -0500 X-MC-Unique: jgb_VtI1NxuSMj29HlwsGw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 48F9C18C89C4; Thu, 14 Jan 2021 09:26:47 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA21D5D9DE; Thu, 14 Jan 2021 09:26:42 +0000 (UTC) To: David Marchand Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-4-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: Date: Thu, 14 Jan 2021 10:26:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH 03/40] net/virtio: refactor virtio-user device X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 1/5/21 10:16 PM, David Marchand wrote: > On Sun, Dec 20, 2020 at 10:14 PM Maxime Coquelin > wrote: >> >> This patch moves the virtio_hw structure into the virtio_user_dev >> structure, with the goal of making virtio_hw bus-agnostic. >> >> Signed-off-by: Maxime Coquelin > > Just one comment, the rest lgtm. > > >> diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c >> index 516d0ee577..1f1f63a1a5 100644 >> --- a/drivers/net/virtio/virtio_user_ethdev.c >> +++ b/drivers/net/virtio/virtio_user_ethdev.c >> @@ -26,13 +26,13 @@ >> #include "virtio_user/virtio_user_dev.h" >> #include "virtio_user/vhost.h" >> >> -#define virtio_user_get_dev(hw) \ >> - ((struct virtio_user_dev *)(hw)->virtio_user_dev) >> +#define virtio_user_get_dev(hw) container_of(hw, struct virtio_user_dev, hw) > > Since the hw parameter is expanded as both the object and the field > name too, this macro prevents us from calling anything but > virtio_user_get_dev(hw). Indeed! I propose to change the parameter to hwp (hw pointer). Thanks, Maxime