X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fnetvsc%2Fhn_var.h;h=8383f3246ca42505fd059d60e9f45d0182fa3bc0;hb=37f4ac5f5946655fddedb8a78c079f2b190fa70e;hp=cd173f6af94269d33760c412bc98147694238e2d;hpb=3c32fdf432345ad037524af3e2f0e3db9ee455cc;p=dpdk.git diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index cd173f6af9..8383f3246c 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -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; @@ -150,6 +154,7 @@ uint16_t hn_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); int hn_tx_pool_init(struct rte_eth_dev *dev); +void hn_tx_pool_uninit(struct rte_eth_dev *dev); int hn_dev_link_update(struct rte_eth_dev *dev, int wait); int hn_dev_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, @@ -169,6 +174,28 @@ int hn_dev_rx_queue_setup(struct rte_eth_dev *dev, struct rte_mempool *mp); void hn_dev_rx_queue_release(void *arg); +/* 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); int hn_vf_add(struct rte_eth_dev *dev, struct hn_data *hv);