diff options
author | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2019-07-04 10:40:06 +0200 |
---|---|---|
committer | Christian Ehrhardt <christian.ehrhardt@canonical.com> | 2019-07-04 10:48:05 +0200 |
commit | 8d53e9f3c6001dcb2865f6e894da5b54e1418f88 (patch) | |
tree | 63907f21c13636a987d43463c675d0727a04e327 /drivers/net/netvsc/hn_var.h | |
parent | e2bea7436061ca2e7e14bfcfdc5870f2555c3965 (diff) |
New upstream version 18.11.2upstream-18.11-stable
Change-Id: I23eb4f9179abf1f9c659891f8fddb27ee68ad26b
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'drivers/net/netvsc/hn_var.h')
-rw-r--r-- | drivers/net/netvsc/hn_var.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index a6516c1e..b3156343 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -91,14 +91,18 @@ 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; - bool closed; - bool vf_present; + uint16_t vf_port; + + uint8_t vf_present; + uint8_t closed; + uint32_t link_status; uint32_t link_speed; @@ -169,6 +173,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); |