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;
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);
}
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];
}
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;
#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 use_msix;
uint8_t mac_addr[ETHER_ADDR_LEN];
};