net: add rte prefix to ether structures
[dpdk.git] / drivers / net / netvsc / hn_var.h
index 7f3266c..bf94d90 100644 (file)
@@ -91,15 +91,19 @@ struct hn_rx_bufinfo {
        struct rte_mbuf_ext_shared_info shinfo;
 } __rte_cache_aligned;
 
+#define HN_INVALID_PORT        UINT16_MAX
+
 struct hn_data {
        struct rte_vmbus_device *vmbus;
        struct hn_rx_queue *primary;
-       struct rte_eth_dev *vf_dev;             /* Subordinate device */
        rte_spinlock_t  vf_lock;
        uint16_t        port_id;
-       uint8_t         closed;
+       uint16_t        vf_port;
+
        uint8_t         vf_present;
+       uint8_t         closed;
        uint8_t         vlan_strip;
+
        uint32_t        link_status;
        uint32_t        link_speed;
 
@@ -127,7 +131,7 @@ struct hn_data {
        rte_atomic32_t  rndis_req_id;
        uint8_t         rndis_resp[256];
 
-       struct ether_addr mac_addr;
+       struct rte_ether_addr mac_addr;
 
        struct rte_eth_dev_owner owner;
        struct rte_intr_handle vf_intr;
@@ -169,6 +173,29 @@ int        hn_dev_rx_queue_setup(struct rte_eth_dev *dev,
                              const struct rte_eth_rxconf *rx_conf,
                              struct rte_mempool *mp);
 void   hn_dev_rx_queue_release(void *arg);
+void   hn_dev_free_queues(struct rte_eth_dev *dev);
+
+/* Check if VF is attached */
+static inline bool
+hn_vf_attached(const struct hn_data *hv)
+{
+       return hv->vf_port != HN_INVALID_PORT;
+}
+
+/* Get VF device for existing netvsc device */
+static inline struct rte_eth_dev *
+hn_get_vf_dev(const struct hn_data *hv)
+{
+       uint16_t vf_port = hv->vf_port;
+
+       /* make sure vf_port is loaded */
+       rte_smp_rmb();
+
+       if (vf_port == HN_INVALID_PORT)
+               return NULL;
+       else
+               return &rte_eth_devices[vf_port];
+}
 
 void   hn_vf_info_get(struct hn_data *hv,
                       struct rte_eth_dev_info *info);
@@ -186,7 +213,7 @@ void        hn_vf_allmulticast_disable(struct rte_eth_dev *dev);
 void   hn_vf_promiscuous_enable(struct rte_eth_dev *dev);
 void   hn_vf_promiscuous_disable(struct rte_eth_dev *dev);
 int    hn_vf_mc_addr_list(struct rte_eth_dev *dev,
-                          struct ether_addr *mc_addr_set,
+                          struct rte_ether_addr *mc_addr_set,
                           uint32_t nb_mc_addr);
 
 int    hn_vf_link_update(struct rte_eth_dev *dev,