hn_vf_remove(hv);
}
+static void
+hn_vf_merge_desc_lim(struct rte_eth_desc_lim *lim,
+ const struct rte_eth_desc_lim *vf_lim)
+{
+ lim->nb_max = RTE_MIN(vf_lim->nb_max, lim->nb_max);
+ lim->nb_min = RTE_MAX(vf_lim->nb_min, lim->nb_min);
+ lim->nb_align = RTE_MAX(vf_lim->nb_align, lim->nb_align);
+ lim->nb_seg_max = RTE_MIN(vf_lim->nb_seg_max, lim->nb_seg_max);
+ lim->nb_mtu_seg_max = RTE_MIN(vf_lim->nb_seg_max, lim->nb_seg_max);
+}
+
/*
* Merge the info from the VF and synthetic path.
* use the default config of the VF
info->max_tx_queues);
info->tx_offload_capa &= vf_info.tx_offload_capa;
info->tx_queue_offload_capa &= vf_info.tx_queue_offload_capa;
+ hn_vf_merge_desc_lim(&info->tx_desc_lim, &vf_info.tx_desc_lim);
info->min_rx_bufsize = RTE_MAX(vf_info.min_rx_bufsize,
info->min_rx_bufsize);
info->max_rx_pktlen = RTE_MAX(vf_info.max_rx_pktlen,
info->max_rx_pktlen);
+ hn_vf_merge_desc_lim(&info->rx_desc_lim, &vf_info.rx_desc_lim);
return 0;
}
rte_spinlock_unlock(&hv->vf_lock); \
}
+/* If VF is present, then cascade configuration down */
+#define VF_ETHDEV_FUNC_RET_STATUS(dev, func) \
+ { \
+ struct hn_data *hv = (dev)->data->dev_private; \
+ struct rte_eth_dev *vf_dev; \
+ int ret = 0; \
+ rte_spinlock_lock(&hv->vf_lock); \
+ vf_dev = hn_get_vf_dev(hv); \
+ if (vf_dev) \
+ ret = func(vf_dev->data->port_id); \
+ rte_spinlock_unlock(&hv->vf_lock); \
+ return ret; \
+ }
+
void hn_vf_reset(struct rte_eth_dev *dev)
{
VF_ETHDEV_FUNC(dev, rte_eth_dev_reset);
rte_spinlock_unlock(&hv->vf_lock);
}
-void hn_vf_stats_reset(struct rte_eth_dev *dev)
+int hn_vf_stats_reset(struct rte_eth_dev *dev)
{
- VF_ETHDEV_FUNC(dev, rte_eth_stats_reset);
+ VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_stats_reset);
}
-void hn_vf_allmulticast_enable(struct rte_eth_dev *dev)
+int hn_vf_allmulticast_enable(struct rte_eth_dev *dev)
{
- VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_enable);
+ VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_allmulticast_enable);
}
-void hn_vf_allmulticast_disable(struct rte_eth_dev *dev)
+int hn_vf_allmulticast_disable(struct rte_eth_dev *dev)
{
- VF_ETHDEV_FUNC(dev, rte_eth_allmulticast_disable);
+ VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_allmulticast_disable);
}
-void hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_enable(struct rte_eth_dev *dev)
{
- VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_enable);
+ VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_enable);
}
-void hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
+int hn_vf_promiscuous_disable(struct rte_eth_dev *dev)
{
- VF_ETHDEV_FUNC(dev, rte_eth_promiscuous_disable);
+ VF_ETHDEV_FUNC_RET_STATUS(dev, rte_eth_promiscuous_disable);
}
int hn_vf_mc_addr_list(struct rte_eth_dev *dev,
return count;
}
-void hn_vf_xstats_reset(struct rte_eth_dev *dev)
+int hn_vf_xstats_reset(struct rte_eth_dev *dev)
{
struct hn_data *hv = dev->data->dev_private;
struct rte_eth_dev *vf_dev;
+ int ret;
rte_spinlock_lock(&hv->vf_lock);
vf_dev = hn_get_vf_dev(hv);
if (vf_dev)
- rte_eth_xstats_reset(vf_dev->data->port_id);
+ ret = rte_eth_xstats_reset(vf_dev->data->port_id);
+ else
+ ret = -EINVAL;
rte_spinlock_unlock(&hv->vf_lock);
+
+ return ret;
}
int hn_vf_rss_hash_update(struct rte_eth_dev *dev,