From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 4CB222B98 for ; Tue, 11 Oct 2016 14:28:43 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 11 Oct 2016 05:28:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,329,1473145200"; d="scan'208";a="18384186" Received: from unknown (HELO [10.237.220.94]) ([10.237.220.94]) by fmsmga006.fm.intel.com with ESMTP; 11 Oct 2016 05:28:41 -0700 To: Keith Wiles , dev@dpdk.org References: <1474423220-10207-1-git-send-email-keith.wiles@intel.com> <1475592311-25749-1-git-send-email-keith.wiles@intel.com> Cc: pmatilai@redhat.com, yuanhan.liu@linux.intel.com From: Ferruh Yigit Message-ID: Date: Tue, 11 Oct 2016 13:28:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1475592311-25749-1-git-send-email-keith.wiles@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v4] drivers/net:new PMD using tun/tap host interface 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: Tue, 11 Oct 2016 12:28:43 -0000 On 10/4/2016 3:45 PM, Keith Wiles wrote: > +/* > + * Open a TAP interface device. > + */ > +static int > +rte_pmd_tap_devinit(const char *name, const char *params) > +{ > + int ret = 0; > + struct rte_kvargs *kvlist; > + struct tap_info tap_info; > + > + /* Setup default values */ > + memset(&tap_info, 0, sizeof(tap_info)); > + > + tap_info.speed = ETH_SPEED_NUM_10G; > + snprintf(tap_info.name, sizeof(tap_info.name), "dtap%d", tap_unit++); > + > + if ((params == NULL) || (params[0] == '\0')) { > + RTE_LOG(INFO, PMD, "Initializing pmd_tap for %s\n", name); > + > + ret = eth_dev_tap_create(name, &tap_info); > + goto leave; > + } > + > + RTE_LOG(INFO, PMD, "Initialize %s with params (%s)\n", name, params); > + > + kvlist = rte_kvargs_parse(params, valid_arguments); > + if (!kvlist) { > + ret = eth_dev_tap_create(name, &tap_info); > + goto leave; > + } > + > + if (rte_kvargs_count(kvlist, ETH_TAP_SPEED_ARG) == 1) { > + ret = rte_kvargs_process(kvlist, ETH_TAP_SPEED_ARG, > + &set_interface_speed, &tap_info); > + if (ret < 0) > + goto leave; > + } else > + set_interface_speed(NULL, NULL, &tap_info); > + > + if (rte_kvargs_count(kvlist, ETH_TAP_IFACE_ARG) == 1) { > + ret = rte_kvargs_process(kvlist, ETH_TAP_IFACE_ARG, > + &set_interface_name, &tap_info); > + if (ret < 0) > + goto leave; > + } else > + set_interface_name(NULL, NULL, (void *)&tap_info); Also there must be a eth_dev_tap_create() call after this point to use tap_info struct with custom values, right? "--vdev eth_tap0,iface=foo0" parameter shouldn't be working with this code, right? > + > + rte_kvargs_free(kvlist); > + > +leave: > + if (ret == -1) > + RTE_LOG(INFO, PMD, "Failed to create pmd_tap for %s\n", name); > + > + return ret; > +}