From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 01 Jun 2016 01:23:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,400,1459839600"; d="scan'208";a="819130196" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga003.jf.intel.com with ESMTP; 01 Jun 2016 01:23:14 -0700 Date: Wed, 1 Jun 2016 16:26:05 +0800 From: Yuanhan Liu To: Jianfeng Tan 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 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 Content-Disposition: inline In-Reply-To: <1464605739-140761-8-git-send-email-jianfeng.tan@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v5 7/8] virtio-user: add a new vdev named virtio-user X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jun 2016 08:23:16 -0000 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