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 4801FA0A02; Fri, 15 Jan 2021 10:40:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBDB1140E38; Fri, 15 Jan 2021 10:40:02 +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 521CF140E21 for ; Fri, 15 Jan 2021 10:40:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610703601; 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=PETfx5IdrQlBVBCQcfWdW1goD7Uw3VBkAAXU1vmTGJI=; b=BjnnEJ2Ms6RgOrRbizsJ+SCHJYozfjcarhezoy51+DhTGvpn7bV8n277ORbEwCbTY3RwQl w7E8y/OfdKoxFHGUsYflsXTMeGCvp4DJZhIYs6CYYHubpLZaFnXe7uhW2/aOIHyRN4FyO5 qe59LC1oPugvgGHnqb8FJLBNsDPmPn8= 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-279-Oiicjt4mPtiNg_oIOnOGoA-1; Fri, 15 Jan 2021 04:39:59 -0500 X-MC-Unique: Oiicjt4mPtiNg_oIOnOGoA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 126F6107ACF7; Fri, 15 Jan 2021 09:39:58 +0000 (UTC) Received: from [10.36.110.24] (unknown [10.36.110.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C00B410013C1; Fri, 15 Jan 2021 09:39:53 +0000 (UTC) To: David Marchand Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-17-maxime.coquelin@redhat.com> From: Maxime Coquelin Message-ID: <67815b48-c2a6-a6a2-1123-f0e2315c9026@redhat.com> Date: Fri, 15 Jan 2021 10:39:51 +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.84 on 10.5.11.22 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 16/40] net/virtio: introduce generic virtio header 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/6/21 11:08 AM, David Marchand wrote: > On Sun, Dec 20, 2020 at 10:15 PM Maxime Coquelin > wrote: >> diff --git a/drivers/net/virtio/virtio.h b/drivers/net/virtio/virtio.h >> new file mode 100644 >> index 0000000000..eb078bc227 >> --- /dev/null >> +++ b/drivers/net/virtio/virtio.h >> @@ -0,0 +1,75 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright(c) 2010-2014 Intel Corporation >> + * Copyright(c) 2020 Red Hat, Inc. > > 2021? Well, it was still 2020 when I submitted the patch :) I'll change it when fixing comment below > > >> + */ >> + >> +#ifndef _VIRTIO_H_ >> +#define _VIRTIO_H_ >> + >> +#include >> + >> +struct virtio_hw { >> + struct virtqueue **vqs; >> + uint64_t guest_features; >> + uint16_t vtnet_hdr_size; >> + uint8_t started; >> + uint8_t weak_barriers; >> + uint8_t vlan_strip; >> + uint8_t has_tx_offload; >> + uint8_t has_rx_offload; >> + uint8_t use_vec_rx; >> + uint8_t use_vec_tx; >> + uint8_t use_inorder_rx; >> + uint8_t use_inorder_tx; >> + uint8_t opened; >> + uint16_t port_id; >> + uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; >> + uint32_t speed; /* link speed in MB */ >> + uint8_t duplex; >> + uint8_t use_msix; >> + uint16_t max_mtu; >> + /* >> + * App management thread and virtio interrupt handler thread >> + * both can change device state, this lock is meant to avoid >> + * such a contention. >> + */ >> + rte_spinlock_t state_lock; >> + struct rte_mbuf **inject_pkts; >> + uint16_t max_queue_pairs; >> + uint64_t req_guest_features; >> + struct virtnet_ctl *cvq; >> +}; >> + >> +struct virtio_ops { >> + void (*read_dev_cfg)(struct virtio_hw *hw, size_t offset, void *dst, int len); >> + void (*write_dev_cfg)(struct virtio_hw *hw, size_t offset, const void *src, int len); >> + uint8_t (*get_status)(struct virtio_hw *hw); >> + void (*set_status)(struct virtio_hw *hw, uint8_t status); >> + uint64_t (*get_features)(struct virtio_hw *hw); >> + void (*set_features)(struct virtio_hw *hw, uint64_t features); >> + int (*features_ok)(struct virtio_hw *hw); >> + uint8_t (*get_isr)(struct virtio_hw *hw); >> + uint16_t (*set_config_irq)(struct virtio_hw *hw, uint16_t vec); >> + uint16_t (*set_queue_irq)(struct virtio_hw *hw, struct virtqueue *vq, uint16_t vec); >> + uint16_t (*get_queue_num)(struct virtio_hw *hw, uint16_t queue_id); >> + int (*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); >> + int (*dev_close)(struct virtio_hw *hw); >> +}; >> + >> +/* >> + * While virtio_hw is stored in shared memory, this structure stores >> + * some infos that may vary in the multiple process model locally. >> + * For example, the vtpci_ops pointer. > > You can remove this comment on vtpci_ops. > I think the comment is still valid, just that it now applied to virtio_ops instead of vtpci_ops. I'll fix it. Thanks, Maxime