From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-f41.google.com (mail-pb0-f41.google.com [209.85.160.41]) by dpdk.org (Postfix) with ESMTP id 981CEAF85 for ; Sat, 14 Jun 2014 03:09:24 +0200 (CEST) Received: by mail-pb0-f41.google.com with SMTP id ma3so2647906pbc.28 for ; Fri, 13 Jun 2014 18:09:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=1DEQhoHIJD0jiu/+WIAXFtM0gD//W/dURhyxD3gzRlg=; b=DWYSROeMVquU38704gUbTvJ1fhFQgltWmT+i6SL6s7fs67lPqQqjmN434PnV8Dirx0 cYZTOZp9K3mUJ41ue3ZrSKNP9LTsQdLrmdivCVbgzC+OJjmAuoeVca3vgMZHGxOrcOMI qOgENHYhemavJNcPlzU+oioXtSfhBu0a0fwinvfkvdvMa6rxUyqrwqyfEHAtlO14ptH1 009GL+KYIY4iXldHuXN9sH0XCS6ySLvXxdm4PL+B06hIqq0lDXg74s5ZAFUV6ND4T5OT ePZeitxz4dAJo255zNmG7WbLt5DLo02LVdq3U+Yd1T6Xqtb+M3ymuVuNrmyqEjElmjh5 dZRg== X-Gm-Message-State: ALoCoQn6yxX7VQdO9u77tHlUYj+df1T33TYx+6Ar+ciTsFwK5FF7vWygcGWAHLtQ0sHHafnOSMgl X-Received: by 10.68.254.5 with SMTP id ae5mr7204427pbd.83.1402708179755; Fri, 13 Jun 2014 18:09:39 -0700 (PDT) Received: from localhost (static-50-53-83-51.bvtn.or.frontiernet.net. [50.53.83.51]) by mx.google.com with ESMTPSA id gw8sm5827444pbc.28.2014.06.13.18.09.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jun 2014 18:09:39 -0700 (PDT) Message-Id: <20140614010930.106119615@networkplumber.org> User-Agent: quilt/0.63-1 Date: Fri, 13 Jun 2014 18:06:25 -0700 From: Stephen Hemminger To: dev@dpdk.org References: <20140614010617.902738763@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=virtio-hw-simplify.patch Subject: [dpdk-dev] [PATCH 8/8] virtio: simplify the hardware structure 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: Sat, 14 Jun 2014 01:09:25 -0000 The host_features are never used after negotiation. The PCI information is unused (and available in rte_pci if needed). Signed-off-by: Stephen Hemminger --- a/lib/librte_pmd_virtio/virtio_ethdev.c 2014-06-13 18:01:46.905019605 -0700 +++ b/lib/librte_pmd_virtio/virtio_ethdev.c 2014-06-13 18:02:16.605057212 -0700 @@ -559,7 +559,7 @@ virtio_get_hwaddr(struct virtio_hw *hw) static void virtio_negotiate_features(struct virtio_hw *hw) { - uint32_t guest_features, mask; + uint32_t host_features, mask; mask = VIRTIO_NET_F_CTRL_RX | VIRTIO_NET_F_CTRL_VLAN; mask |= VIRTIO_NET_F_CSUM | VIRTIO_NET_F_GUEST_CSUM; @@ -578,20 +578,20 @@ virtio_negotiate_features(struct virtio_ mask |= VIRTIO_RING_F_INDIRECT_DESC; /* Prepare guest_features: feature that driver wants to support */ - guest_features = VTNET_FEATURES & ~mask; + hw->guest_features = VTNET_FEATURES & ~mask; PMD_INIT_LOG(DEBUG, "guest_features before negotiate = %x", guest_features); /* Read device(host) feature bits */ - hw->host_features = VIRTIO_READ_REG_4(hw, VIRTIO_PCI_HOST_FEATURES); + host_features = VIRTIO_READ_REG_4(hw, VIRTIO_PCI_HOST_FEATURES); PMD_INIT_LOG(DEBUG, "host_features before negotiate = %x", - hw->host_features); + host_features); /* * Negotiate features: Subset of device feature bits are written back * guest feature bits. */ - hw->guest_features = vtpci_negotiate_features(hw, guest_features); + hw->guest_features = vtpci_negotiate_features(hw, host_features); PMD_INIT_LOG(DEBUG, "features after negotiate = %x", hw->guest_features); } @@ -730,8 +730,6 @@ eth_virtio_dev_init(__rte_unused struct pci_dev = eth_dev->pci_dev; - hw->device_id = pci_dev->id.device_id; - hw->vendor_id = pci_dev->id.vendor_id; #ifdef RTE_EXEC_ENV_LINUXAPP { char dirname[PATH_MAX]; --- a/lib/librte_pmd_virtio/virtio_pci.c 2014-06-13 18:01:46.905019605 -0700 +++ b/lib/librte_pmd_virtio/virtio_pci.c 2014-06-13 18:01:46.901019599 -0700 @@ -82,14 +82,14 @@ vtpci_write_dev_config(struct virtio_hw } uint32_t -vtpci_negotiate_features(struct virtio_hw *hw, uint32_t guest_features) +vtpci_negotiate_features(struct virtio_hw *hw, uint32_t host_features) { uint32_t features; /* * Limit negotiated features to what the driver, virtqueue, and * host all support. */ - features = (hw->host_features) & guest_features; + features = host_features & hw->guest_features; VIRTIO_WRITE_REG_4(hw, VIRTIO_PCI_GUEST_FEATURES, features); return features; --- a/lib/librte_pmd_virtio/virtio_pci.h 2014-06-13 18:01:46.905019605 -0700 +++ b/lib/librte_pmd_virtio/virtio_pci.h 2014-06-13 18:01:46.905019605 -0700 @@ -162,21 +162,13 @@ struct virtqueue; #define VIRTIO_MAX_VIRTQUEUES 8 struct virtio_hw { + struct virtqueue *cvq; uint32_t io_base; - uint32_t host_features; uint32_t guest_features; - struct virtqueue *cvq; - - uint16_t vtnet_hdr_size; - uint32_t max_tx_queues; uint32_t max_rx_queues; - uint16_t device_id; - uint16_t vendor_id; - uint16_t subsystem_device_id; - uint16_t subsystem_vendor_id; - uint8_t revision_id; + uint16_t vtnet_hdr_size; uint8_t mac_addr[ETHER_ADDR_LEN]; };