From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9A0FD3237 for ; Mon, 30 Jan 2017 19:20:23 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP; 30 Jan 2017 10:20:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,312,1477983600"; d="scan'208";a="59220473" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga005.fm.intel.com with ESMTP; 30 Jan 2017 10:20:22 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 30 Jan 2017 10:20:21 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.230]) by FMSMSX153.amr.corp.intel.com ([169.254.9.17]) with mapi id 14.03.0248.002; Mon, 30 Jan 2017 10:20:22 -0800 From: "Wiles, Keith" To: "Yigit, Ferruh" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] net/tap: driver closing tx interface on queue setup Thread-Index: AQHSeugNf/Oo2Oh9K0+Thn0jLxcaCaFRnDmAgAA0gQCAAAqYgA== Date: Mon, 30 Jan 2017 18:20:21 +0000 Message-ID: <62618BAE-2D3C-41AC-979B-85C67BEF5144@intel.com> References: <20170129021205.36860-1-keith.wiles@intel.com> <2c430141-94c1-5482-7fc2-94f5908b41e0@intel.com> <6B37A978-0F89-4299-86E1-5697392EDC49@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.252.137.159] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/tap: driver closing tx interface on queue setup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2017 18:20:24 -0000 > On Jan 30, 2017, at 11:42 AM, Yigit, Ferruh wrot= e: >=20 > On 1/30/2017 2:34 PM, Wiles, Keith wrote: >>=20 >>> On Jan 30, 2017, at 5:00 AM, Yigit, Ferruh wro= te: >>>=20 >>> On 1/29/2017 2:12 AM, Keith Wiles wrote: >>>> The tap driver setup both rx and tx file descriptors when the >>>> rte_eth_rx_queue_setup() causing the tx to be closed when tx setup >>>> was called. >>>=20 >>> Can you please describe the problem more. >>> Without this patch rx->fd =3D=3D tx->fd, with this patch rx and tx has >>> different file descriptors. >>=20 >> Let me look at this more, I am getting the same FD for both. Must be som= ething else going on. >=20 > After patch, tun_alloc() called twice, one for Rx_q and other for Tx_q. > And tun_alloc does open() to "/dev/net/tun", I expect they get different > file descriptors. It is not called twice, it is only called once in the eth_dev_tap_create() = routine and the fd is placed in the rxq/txq using the same fd. Then look in= the rx/tx_setup_queue routines only update the fd and call tun_alloc if th= e fd is -1. Now looking at this code it seems a bit silly, but it was tryin= g to deal with the setting up the new queue. It seems to be this logic not = going to work with multiple queues in the same device and needs to be rewor= ked. I need to rework the code and do some cleanup. The current patch should wor= k for a single queue per device. Thanks >=20 > And if they have same FD, won't this cause same problem, > rx_queue_setup() will close the FD, if Tx_q has same FD it will have > invalid descriptor. >=20 >>=20 >>>=20 >>> What was the wrong with rx and tx having same fd? >>>=20 >>> As far as I can see, rte_eth_rx_queue_setup() won't close tx->fd, that >>> function will do nothing if rx or tx has valid fd. >>=20 >> The rte_eth_rx_queue_setup() look at line 1146 if rxq has a value then r= elease it, which happens on both Rx/Tx code >>=20 >> rxq =3D dev->data->rx_queues; >> if (rxq[rx_queue_id]) { >> RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_release, >> -ENOTSUP); >> (*dev->dev_ops->rx_queue_release)(rxq[rx_queue_id]); >> rxq[rx_queue_id] =3D NULL; >> } >=20 > Got it thanks, I missed (relatively new) above code piece. >=20 >>=20 >> if (rx_conf =3D=3D NULL) >> rx_conf =3D &dev_info.default_rxconf; >>=20 >> ret =3D (*dev->dev_ops->rx_queue_setup)(dev, rx_queue_id, nb_rx_desc, >> socket_id, rx_conf, mp); >>=20 >>>=20 >>>>=20 >>>> Signed-off-by: Keith Wiles >>>=20 >>> <...> >>=20 >> Regards, >> Keith Regards, Keith