From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw1015.ocn.ad.jp (mogw1015.ocn.ad.jp [153.149.231.21]) by dpdk.org (Postfix) with ESMTP id CA4951B43D for ; Sat, 24 Nov 2018 15:54:36 +0100 (CET) Received: from mf-smf-unw001c3 (mf-smf-unw001c3.ocn.ad.jp [153.138.219.68]) by mogw1015.ocn.ad.jp (Postfix) with ESMTP id 9DF81802D1; Sat, 24 Nov 2018 23:54:34 +0900 (JST) Received: from ocn-vc-mts-101c1.ocn.ad.jp ([153.153.66.78]) by mf-smf-unw001c3 with ESMTP id QZIKgVmfNZWoBQZKMgVE7J; Sat, 24 Nov 2018 23:54:34 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.134]) by ocn-vc-mts-101c1.ocn.ad.jp with ESMTP id QZKMgBtOVEH5BQZKMgGcYY; Sat, 24 Nov 2018 23:54:34 +0900 Received: from mugwort.local (p3371093-ipngn19601marunouchi.tokyo.ocn.ne.jp [153.228.164.93]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Sat, 24 Nov 2018 23:54:34 +0900 (JST) To: x-fn-spp@sl.ntt-tx.co.jp Cc: ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp, spp@dpdk.org References: <201811070507.wA757WWo008866@imss03.silk.ntt-tx.co.jp> <201811210652.wAL6qKJe011052@imss04.silk.ntt-tx.co.jp> From: Yasufumi Ogawa Message-ID: <6eb5d6a7-af80-1158-f395-c95207634c70@juno.ocn.ne.jp> Date: Sat, 24 Nov 2018 23:54:33 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <201811210652.wAL6qKJe011052@imss04.silk.ntt-tx.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [spp] [PATCH v2 1/6] shared: add dev_attach_by_devargs X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2018 14:54:37 -0000 > SPP uses deprecated APIs removed in DPDK v18.11. Using rte_eth_hotplug_add() > is recommended instead of rte_eth_dev_attach()[1]. This patch is to add > dev_attach_by_devargs() to shared directory so that spp_primary, spp_nfv, > spp_vm and spp_vf can refer this new function. Hideyuki, The number of characters per line should be less than 72. It exceeds the limitation in 1st and 3rd lines. Thanks > > [1]https://mails.dpdk.org/archives/dev/2018-October/117115.html > > Signed-off-by: Hideyuki Yamashita > Signed-off-by: Naoki Takada > --- > src/shared/common.c | 26 ++++++++++++++++++++++++++ > src/shared/common.h | 17 +++++++++++++++++ > 2 files changed, 43 insertions(+) > > diff --git a/src/shared/common.c b/src/shared/common.c > index f1754db..c88ce14 100644 > --- a/src/shared/common.c > +++ b/src/shared/common.c > @@ -500,3 +500,29 @@ append_patch_info_json(char *str, > > return 0; > } > + > +/* attach the new device, then store port_id of the device */ > +int > +dev_attach_by_devargs(const char *devargs, uint16_t *port_id) > +{ > + int ret = -1; > + struct rte_devargs da; > + > + memset(&da, 0, sizeof(da)); > + > + /* parse devargs */ > + if (rte_devargs_parse(&da, devargs)) > + return -1; > + > + ret = rte_eal_hotplug_add(da.bus->name, da.name, da.args); > + if (ret < 0) { > + free(da.args); > + return ret; > + } > + > + ret = rte_eth_dev_get_port_by_name(da.name, port_id); > + > + free(da.args); > + > + return ret; > +} > diff --git a/src/shared/common.h b/src/shared/common.h > index a5395aa..60514e5 100644 > --- a/src/shared/common.h > +++ b/src/shared/common.h > @@ -18,7 +18,9 @@ > #include > #include > #include > +#include > #include > +#include > #include > #include > #include > @@ -217,4 +219,19 @@ int spp_atoi(const char *str, int *val); > > #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 > > +/** > + * Attach a new Ethernet device specified by arguments. > + * > + * @param devargs > + * A pointer to a strings array describing the new device > + * to be attached. The strings should be a pci address like > + * '0000:01:00.0' or virtual device name like 'net_pcap0'. > + * @param port_id > + * A pointer to a port identifier actually attached. > + * @return > + * 0 on success and port_id is filled, negative on error > + */ > +int > +dev_attach_by_devargs(const char *devargs, uint16_t *port_id); > + > #endif >