From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 50B3F8E96 for ; Tue, 29 Dec 2015 12:31:40 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 29 Dec 2015 03:31:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,495,1444719600"; d="scan'208";a="716773759" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 29 Dec 2015 03:31:38 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 29 Dec 2015 03:31:38 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 29 Dec 2015 03:31:38 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.57]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.111]) with mapi id 14.03.0248.002; Tue, 29 Dec 2015 19:31:36 +0800 From: "Tan, Jianfeng" To: Yuanhan Liu , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 2/6] virtio: introduce struct virtio_pci_ops Thread-Index: AQHRMv5h5UbNGj6+C0y3CSQYxdqD5Z7h8cLQ Date: Tue, 29 Dec 2015 11:31:35 +0000 Message-ID: References: <1449719650-3482-1-git-send-email-yuanhan.liu@linux.intel.com> <1449719650-3482-3-git-send-email-yuanhan.liu@linux.intel.com> In-Reply-To: <1449719650-3482-3-git-send-email-yuanhan.liu@linux.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/6] virtio: introduce struct virtio_pci_ops 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, 29 Dec 2015 11:31:40 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yuanhan Liu > Sent: Thursday, December 10, 2015 11:54 AM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 2/6] virtio: introduce struct virtio_pci_ops >=20 > Introduce struct virtio_pci_ops, to let legacy virtio (v0.95) and > modern virtio (1.0) have different implementation regarding to a > specific pci action, such as read host status. >=20 ... > +static void > +legacy_reset(struct virtio_hw *hw) > +{ > + /* > + * Setting the status to RESET sets the host device to > + * the original, uninitialized state. > + */ > + legacy_set_status(hw, VIRTIO_CONFIG_STATUS_RESET); > + legacy_get_status(hw); May need a comment to explain why here we need to get_status(). > +} > + > +static uint8_t > +legacy_get_isr(struct virtio_hw *hw) > +{ Please delete the following blank line. > + > + return VIRTIO_READ_REG_1(hw, VIRTIO_PCI_ISR); > +} > + > +/* Enable one vector (0) for Link State Intrerrupt */ > +static uint16_t > +legacy_set_irq(struct virtio_hw *hw, uint16_t vec) > +{ > + VIRTIO_WRITE_REG_2(hw, VIRTIO_MSI_CONFIG_VECTOR, vec); > + return VIRTIO_READ_REG_2(hw, VIRTIO_MSI_CONFIG_VECTOR); > +} > + ... > + > +struct virtio_pci_ops { > + void (*read_dev_cfg)(struct virtio_hw *hw, uint64_t offset, > + void *dst, int len); > + void (*write_dev_cfg)(struct virtio_hw *hw, uint64_t offset, > + void *src, int len); > + void (*reset)(struct virtio_hw *hw); > + > + uint8_t (*get_status)(struct virtio_hw *hw); > + void (*set_status)(struct virtio_hw *hw, uint8_t status); > + > + uint32_t (*get_features)(struct virtio_hw *hw); > + void (*set_features)(struct virtio_hw *hw, uint32_t features); > + > + uint8_t (*get_isr)(struct virtio_hw *hw); > + > + uint16_t (*set_irq)(struct virtio_hw *hw, uint16_t vec); > + > + uint16_t (*get_queue_num)(struct virtio_hw *hw, uint16_t > queue_id); How about changing the name into get_queue_size? From my side, queue_num is= very confusing. Thanks, Jianfeng > + void (*setup_queue)(struct virtio_hw *hw, struct virtqueue *vq); > + void (*del_queue)(struct virtio_hw *hw, struct virtqueue *vq); > + void (*notify_queue)(struct virtio_hw *hw, struct virtqueue *vq); > +}; > + ... > #ifdef RTE_LIBRTE_VIRTIO_DEBUG_DUMP > -- > 1.9.0