From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6E7428E6C for ; Tue, 19 Jan 2016 03:41:52 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 18 Jan 2016 18:41:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,315,1449561600"; d="scan'208";a="635791835" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by FMSMGA003.fm.intel.com with ESMTP; 18 Jan 2016 18:41:52 -0800 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 18 Jan 2016 18:41:51 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.110.15) by fmsmsx121.amr.corp.intel.com (10.18.125.36) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 18 Jan 2016 18:41:51 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.215]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.117]) with mapi id 14.03.0248.002; Tue, 19 Jan 2016 10:41:48 +0800 From: "Xie, Huawei" To: Yuanhan Liu , Tetsuya Mukawa Thread-Topic: [PATCH 3/3] virtio: Add a new layer to abstract pci access method Thread-Index: AdFSYvGNtDRMDkgQSnmGVglmm/j0rA== Date: Tue, 19 Jan 2016 02:41:48 +0000 Message-ID: References: <1453108389-21006-1-git-send-email-mukawa@igel.co.jp> <1453108389-21006-4-git-send-email-mukawa@igel.co.jp> <20160118134645.GC19531@yliu-dev.sh.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.4.160] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH 3/3] virtio: Add a new layer to abstract pci access method X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2016 02:41:52 -0000 On 1/18/2016 9:44 PM, Yuanhan Liu wrote:=0A= > On Mon, Jan 18, 2016 at 06:13:09PM +0900, Tetsuya Mukawa wrote:=0A= >> +struct virtio_pci_access_ops {=0A= >> + uint8_t (*legacy_read8)(struct virtio_hw *hw, uint8_t *addr);=0A= >> + uint16_t (*legacy_read16)(struct virtio_hw *hw, uint16_t *addr);=0A= >> + uint32_t (*legacy_read32)(struct virtio_hw *hw, uint32_t *addr);=0A= >> + void (*legacy_write8)(struct virtio_hw *hw,=0A= >> + uint8_t *addr, uint8_t val);=0A= >> + void (*legacy_write16)(struct virtio_hw *hw,=0A= >> + uint16_t *addr, uint16_t val);=0A= >> + void (*legacy_write32)(struct virtio_hw *hw,=0A= >> + uint32_t *addr, uint32_t val);=0A= >> +=0A= >> + uint8_t (*modern_read8)(struct virtio_hw *hw, uint8_t *addr);=0A= >> + uint16_t (*modern_read16)(struct virtio_hw *hw, uint16_t *addr);=0A= >> + uint32_t (*modern_read32)(struct virtio_hw *hw, uint32_t *addr);=0A= >> + void (*modern_write8)(struct virtio_hw *hw,=0A= >> + uint8_t *addr, uint8_t val);=0A= >> + void (*modern_write16)(struct virtio_hw *hw,=0A= >> + uint16_t *addr, uint16_t val);=0A= >> + void (*modern_write32)(struct virtio_hw *hw,=0A= >> + uint32_t *addr, uint32_t val);=0A= > One thing about abstraction is that you need define one set of operations= ,=0A= > instead of two similar sets. Thus, you need define following operations= =0A= > only:=0A= >=0A= > - read8=0A= > - read16=0A= > - read32=0A= > - write8=0A= > - write16=0A= > - write32=0A= >=0A= > And make a proper assignment after the modern/legacy detection.=0A= =0A= yes, that is how ops abstraction works.=0A= =0A= >=0A= >> +=0A= >> + int (*map_pci_cfg)(struct virtio_hw *hw);=0A= >> + void (*unmap_pci_cfg)(struct virtio_hw *hw);=0A= >> + void *(*get_cfg_addr)(struct virtio_hw *hw,=0A= >> + struct virtio_pci_cap *cap);=0A= >> + int (*read_pci_cfg)(struct virtio_hw *hw,=0A= >> + void *buf, size_t len, off_t offset);=0A= > It'd be good if you can post the patches that use above abstract=0A= > operations, so that people can tell if they are properly defined.=0A= >=0A= > --yliu=0A= >=0A= =0A=