From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 81D76A09FF; Wed, 6 Jan 2021 11:08:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 68C03160932; Wed, 6 Jan 2021 11:08:36 +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 303A916091F for ; Wed, 6 Jan 2021 11:08:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609927714; 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: in-reply-to:in-reply-to:references:references; bh=YyaaDY4hSNB+xhougSAPUQ6FYXVV12NqxlWxol4Dtf4=; b=GpgJlXEMKZpzu+LdMuhzUTarSWtdzLO0BztGkatvJ6BuvAL/nCr1qUeQgtaT2nNZ5gB1hm D/9VPA8LSCRHM3eHSxFmYn1cbia/YetVXGvcRYN9daRQ+VqsOjDfae+Qz8+UUQgkQ0mdg3 Cy6wS5+0t+Fc1U6+aN/dv5qeWIq4ekQ= Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-415-uGXgH7qKMA-jaai-hYoltA-1; Wed, 06 Jan 2021 05:08:30 -0500 X-MC-Unique: uGXgH7qKMA-jaai-hYoltA-1 Received: by mail-vk1-f200.google.com with SMTP id p184so1236029vkd.18 for ; Wed, 06 Jan 2021 02:08:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YyaaDY4hSNB+xhougSAPUQ6FYXVV12NqxlWxol4Dtf4=; b=R36hHSL+tDIs3VcjdG46SU762dt3euwWF940HhNBlmx6C/ColNRW1ICxltN4jNKs48 6Rs/q23hrgd5AR+fpLPqawsSO2UuJKOiUJpzE7m8O8GPOj5fuIrcg4Mk4hOPNrXWMrEQ pVns30NFdJumpkj2mrkXSmqJje924wgNTIOtKncBHVyn+mzBfmnuPabIfItg/3GKQPWM KRCmMX+B3EezVWbVCUhaywePvjURXbFbjxJ58xBZuNrukrsSYP8sfWoUFWAh8ett7v6o wO6DJS0kY5g9CjguGBKfKM+P8K61wNjS/EcdrZNDkOP7iF+lJC6iu6G31wPEMdU42djw u5SA== X-Gm-Message-State: AOAM5313D4Hf8w6lAzkleim8zXAoftabS80hUYfPgS8gbXnpm1Pa4goA OhoKQK1paCr0KrlOBQwBKVU+5Bc5CuThImtLiiKp+8Pjon9ex5NlGgy5UiUSs2bluLUMgVDBG+H krNQz5mq+y2Nedi/DR2A= X-Received: by 2002:a1f:9e83:: with SMTP id h125mr2908128vke.18.1609927710458; Wed, 06 Jan 2021 02:08:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwX80dv4o+B1g3QcRrqcZc1JwdzKni8p0+iPCqhDKKAm8Y1sFGwZ9BdYg11eZKQSAcV2UtQ7utl74dBIFaEUp8= X-Received: by 2002:a1f:9e83:: with SMTP id h125mr2908120vke.18.1609927710276; Wed, 06 Jan 2021 02:08:30 -0800 (PST) MIME-Version: 1.0 References: <20201220211405.313012-1-maxime.coquelin@redhat.com> <20201220211405.313012-17-maxime.coquelin@redhat.com> In-Reply-To: <20201220211405.313012-17-maxime.coquelin@redhat.com> From: David Marchand Date: Wed, 6 Jan 2021 11:08:19 +0100 Message-ID: To: Maxime Coquelin Cc: dev , "Xia, Chenbo" , Olivier Matz , Adrian Moreno Zapata Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 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? > + */ > + > +#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. -- David Marchand