int
virtio_user_start_device(struct virtio_user_dev *dev)
{
- struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
uint64_t features;
int ret;
* replaced when we get proper supports from the
* memory subsystem in the future.
*/
- rte_rwlock_read_lock(&mcfg->memory_hotplug_lock);
+ rte_mcfg_mem_read_lock();
pthread_mutex_lock(&dev->mutex);
if (is_vhost_user_by_type(dev->path) && dev->vhostfd < 0)
dev->started = true;
pthread_mutex_unlock(&dev->mutex);
- rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+ rte_mcfg_mem_read_unlock();
return 0;
error:
pthread_mutex_unlock(&dev->mutex);
- rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock);
+ rte_mcfg_mem_read_unlock();
/* TODO: free resource here or caller to check */
return -1;
}
static inline void
parse_mac(struct virtio_user_dev *dev, const char *mac)
{
- int i, r;
- uint32_t tmp[RTE_ETHER_ADDR_LEN];
+ struct rte_ether_addr tmp;
if (!mac)
return;
- r = sscanf(mac, "%x:%x:%x:%x:%x:%x", &tmp[0],
- &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]);
- if (r == RTE_ETHER_ADDR_LEN) {
- for (i = 0; i < RTE_ETHER_ADDR_LEN; ++i)
- dev->mac_addr[i] = (uint8_t)tmp[i];
+ if (rte_ether_unformat_addr(mac, &tmp) == 0) {
+ memcpy(dev->mac_addr, &tmp, RTE_ETHER_ADDR_LEN);
dev->mac_specified = 1;
} else {
/* ignore the wrong mac, use random mac */