[dpdk-dev] [PATCH v2 3/5] virtio/vdev: add embeded device emulation
Tetsuya Mukawa
mukawa at igel.co.jp
Mon Feb 8 07:59:38 CET 2016
On 2016/02/05 20:20, Jianfeng Tan wrote:
> To implement virtio vdev, we need way to interract with vhost backend.
> And more importantly, needs way to emulate a device into DPDK. So this
> patch acts as embedded device emulation.
>
> Depends on the type of vhost file: vhost-user is used if the given
> path points to a unix socket; vhost-net is used if the given path
> points to a char device.
>
> Signed-off-by: Huawei Xie <huawei.xie at intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
> ---
>
> +void
> +virtio_vdev_init(struct rte_eth_dev_data *data, char *path,
> + int nb_rx, int nb_tx, int nb_cq __attribute__ ((unused)),
> + int queue_num, char *mac, char *ifname)
> +{
> + int i, r;
> + struct stat s;
> + uint32_t tmp[ETHER_ADDR_LEN];
> + struct virtio_hw *hw = data->dev_private;
> +
> + hw->vtpci_ops = &vdev_ops;
> + hw->io_base = 0;
> + hw->use_msix = 0;
> + hw->modern = 0;
> +
> + hw->data = data;
> + hw->path = strdup(path);
> + hw->max_rx_queues = nb_rx;
> + hw->max_tx_queues = nb_tx;
> + hw->queue_num = queue_num;
> + hw->mac_specified = 0;
> + if (mac) {
> + r = sscanf(mac, "%x:%x:%x:%x:%x:%x", &tmp[0],
> + &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]);
> + if (r == ETHER_ADDR_LEN) {
> + for (i = 0; i < ETHER_ADDR_LEN; ++i)
> + hw->mac_addr[i] = (uint8_t)tmp[i];
> + hw->mac_specified = 1;
> + } else
> + PMD_DRV_LOG(WARN, "wrong format of mac: %s", mac);
It seems you cannot use 'WARN' here.
Thanks,
Tetsuya
More information about the dev
mailing list