virtio: refactor pci device code

Type: refactor

Change-Id: I7342178f9ab9adb99b91a4f984bc22bef2ce8021
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index b57c6eb..e1ba71d 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -70,9 +70,6 @@
 #undef _
 } virtio_if_flag_t;
 
-#define VIRTIO_NUM_RX_DESC 256
-#define VIRTIO_NUM_TX_DESC 256
-
 #define VIRTIO_FEATURE(X) (1ULL << X)
 
 #define TX_QUEUE(X) ((X*2) + 1)
@@ -80,6 +77,9 @@
 #define TX_QUEUE_ACCESS(X) (X/2)
 #define RX_QUEUE_ACCESS(X) (X/2)
 
+#define VIRTIO_NUM_RX_DESC 256
+#define VIRTIO_NUM_TX_DESC 256
+
 #define foreach_virtio_if_types \
   _ (TAP, 0)                    \
   _ (TUN, 1)                    \
@@ -93,15 +93,6 @@
     VIRTIO_IF_N_TYPES = (1 << 3),
 } virtio_if_type_t;
 
-
-typedef struct
-{
-  u8 mac[6];
-  u16 status;
-  u16 max_virtqueue_pairs;
-  u16 mtu;
-} virtio_net_config_t;
-
 #define VIRTIO_RING_FLAG_MASK_INT 1
 
 typedef struct
@@ -139,6 +130,8 @@
   u32 as_u32;
 } pci_addr_t;
 
+typedef struct _virtio_pci_func virtio_pci_func_t;
+
 typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
@@ -197,6 +190,7 @@
   u32 tap_flags;
   int ifindex;
   virtio_vring_t *cxq_vring;
+  const virtio_pci_func_t *virtio_pci_func;
 } virtio_if_t;
 
 typedef struct
@@ -245,7 +239,6 @@
     }
 }
 
-
 #define virtio_log_debug(vif, f, ...)				\
 {								\
   vlib_log(VLIB_LOG_LEVEL_DEBUG, virtio_main.log_default,	\