From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: Re: [PATCH v2 3/5] virtio/vdev: add embeded device emulation Date: Mon, 8 Feb 2016 15:59:38 +0900 Message-ID: <56B83CDA.7020106@igel.co.jp> References: <1446748276-132087-1-git-send-email-jianfeng.tan@intel.com> <1454671228-33284-1-git-send-email-jianfeng.tan@intel.com> <1454671228-33284-4-git-send-email-jianfeng.tan@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Cc: nakajima.yoshihiro@lab.ntt.co.jp, mst@redhat.com, ann.zhuangyanying@huawei.com To: Jianfeng Tan , dev@dpdk.org Return-path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by dpdk.org (Postfix) with ESMTP id 4C7F0377E for ; Mon, 8 Feb 2016 07:59:43 +0100 (CET) Received: by mail-pa0-f51.google.com with SMTP id cy9so69293514pac.0 for ; Sun, 07 Feb 2016 22:59:43 -0800 (PST) In-Reply-To: <1454671228-33284-4-git-send-email-jianfeng.tan@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > Signed-off-by: Jianfeng Tan > --- > > +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