All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH 8/8] virtio: simplify the hardware structure
Date: Fri, 13 Jun 2014 18:06:25 -0700	[thread overview]
Message-ID: <20140614010930.106119615@networkplumber.org> (raw)
In-Reply-To: 20140614010617.902738763@networkplumber.org

[-- Attachment #1: virtio-hw-simplify.patch --]
[-- Type: text/plain, Size: 3252 bytes --]

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 <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>


--- 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];
 };
 

  parent reply	other threads:[~2014-06-14  1:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14  1:06 [PATCH 0/8] virtio driver phase 2 Stephen Hemminger
2014-06-14  1:06 ` [PATCH 1/8] virtio: maintain stats per queue Stephen Hemminger
2014-06-14  1:06 ` [PATCH 2/8] virtio: dont double space log messages Stephen Hemminger
2014-06-14  1:06 ` [PATCH 3/8] virtio: deinline some code Stephen Hemminger
2014-06-14  1:06 ` [PATCH 4/8] virtio: check for transmit checksum config error Stephen Hemminger
2014-06-14  1:06 ` [PATCH 5/8] virtio: check for ip checksum offload Stephen Hemminger
2014-06-14  1:06 ` [PATCH 6/8] virtio: remove unused virtqueue name Stephen Hemminger
2014-06-14  1:06 ` [PATCH 7/8] virtio: remove unused adapter_stopped field Stephen Hemminger
2014-06-14  1:06 ` Stephen Hemminger [this message]
     [not found] ` <20140614010617.902738763-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2014-06-17 23:35   ` [PATCH 0/8] virtio driver phase 2 Stephen Hemminger
     [not found]     ` <20140617163541.1debf76e-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2014-06-19 10:14       ` Carew, Alan
2014-06-20 13:34   ` Carew, Alan
     [not found]     ` <0E29434AEE0C3A4180987AB476A6F630593A81F5-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-07-22 13:19       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140614010930.106119615@networkplumber.org \
    --to=stephen-otpzqlsittunbdjkjebofr2eb7je58tq@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.