From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 01 Jun 2016 18:27:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,404,1459839600"; d="scan'208";a="989281366" Received: from shwdeisgchi083.ccr.corp.intel.com (HELO [10.239.67.193]) ([10.239.67.193]) by orsmga002.jf.intel.com with ESMTP; 01 Jun 2016 18:27:17 -0700 To: Yuanhan Liu 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> 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 From: "Tan, Jianfeng" Message-ID: <1e2c5d08-db50-3e27-235d-bd8c6ad52096@intel.com> Date: Thu, 2 Jun 2016 09:27:17 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160601082605.GG10038@yliu-dev.sh.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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: Thu, 02 Jun 2016 01:27:21 -0000 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