From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Tan, Jianfeng" Subject: Re: [PATCH v5 7/8] virtio-user: add a new vdev named virtio-user Date: Thu, 2 Jun 2016 09:27:17 +0800 Message-ID: <1e2c5d08-db50-3e27-235d-bd8c6ad52096@intel.com> References: <1446748276-132087-1-git-send-email-jianfeng.tan@intel.com> <1464605739-140761-1-git-send-email-jianfeng.tan@intel.com> <1464605739-140761-8-git-send-email-jianfeng.tan@intel.com> <20160601082605.GG10038@yliu-dev.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, Huawei Xie , rich.lane@bigswitch.com, mst@redhat.com, nakajima.yoshihiro@lab.ntt.co.jp, p.fedin@samsung.com, ann.zhuangyanying@huawei.com, mukawa@igel.co.jp, nhorman@tuxdriver.com To: Yuanhan Liu Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A71E868DD for ; Thu, 2 Jun 2016 03:27:20 +0200 (CEST) In-Reply-To: <20160601082605.GG10038@yliu-dev.sh.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" Hi Yuanhan, On 6/1/2016 4:26 PM, Yuanhan Liu wrote: > On Mon, May 30, 2016 at 10:55:38AM +0000, Jianfeng Tan wrote: >> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c >> index 41d8ad1..5e4f60b 100644 >> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c >> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c >> @@ -166,3 +166,312 @@ int virtio_user_stop_device(struct virtio_user_dev *dev) >> return vhost_call(dev->vhostfd, dev->type, VHOST_MSG_RESET_OWNER, NULL); >> } >> >> +static inline void parse_mac(struct virtio_user_dev *dev, const char *mac) > Note that this is a slight coding style offensive. OK, I'll fix it. > >> +{ >> + int i, r; >> + uint32_t tmp[ETHER_ADDR_LEN]; >> + >> + 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 == ETHER_ADDR_LEN) { >> + for (i = 0; i < ETHER_ADDR_LEN; ++i) >> + dev->mac_addr[i] = (uint8_t)tmp[i]; >> + dev->mac_specified = 1; >> + } else { >> + /* ignore the wrong mac, use random mac */ >> + PMD_DRV_LOG(ERR, "wrong format of mac: %s", mac); >> + } >> +} >> + >> +static int >> +virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, >> + int queue_size, const char *mac, char *ifname) > As stated in last email, we should move all others (except above 2 > functions) to the driver layer, where they belong to. OK, I'll create a virtio_user_ethdev.c to store these things. Thanks, Jianfeng > > --yliu