From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v5 7/8] virtio-user: add a new vdev named virtio-user Date: Wed, 1 Jun 2016 16:26:05 +0800 Message-ID: <20160601082605.GG10038@yliu-dev.sh.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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Jianfeng Tan Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3685C2C6B for ; Wed, 1 Jun 2016 10:23:16 +0200 (CEST) Content-Disposition: inline In-Reply-To: <1464605739-140761-8-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 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. > +{ > + 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. --yliu