From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 9041712A8 for ; Mon, 30 Jan 2017 21:57:40 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 30 Jan 2017 12:57:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,312,1477983600"; d="scan'208";a="1100876764" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 30 Jan 2017 12:57:39 -0800 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 30 Jan 2017 12:57:39 -0800 Received: from fmsmsx113.amr.corp.intel.com ([169.254.13.230]) by fmsmsx121.amr.corp.intel.com ([169.254.6.23]) with mapi id 14.03.0248.002; Mon, 30 Jan 2017 12:57:39 -0800 From: "Wiles, Keith" To: "Yigit, Ferruh" CC: "dev@dpdk.org" Thread-Topic: [PATCH v2] net/tap: fix invalid queue file descriptor Thread-Index: AQHSezsabJZr8fs3B02uTo0MOBSbmaFSBpkA Date: Mon, 30 Jan 2017 20:57:38 +0000 Message-ID: <180E842F-5344-4E7D-B46E-6A58232A680F@intel.com> References: <20170129021205.36860-1-keith.wiles@intel.com> <20170130205445.7527-1-ferruh.yigit@intel.com> In-Reply-To: <20170130205445.7527-1-ferruh.yigit@intel.com> 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 v2] net/tap: fix invalid queue file descriptor 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 20:57:41 -0000 > On Jan 30, 2017, at 2:54 PM, Yigit, Ferruh wrote= : >=20 > From: Keith Wiles >=20 > Rx and Tx queues share the common tap file descriptor, but save this > value separately. >=20 > Setting up Rx/Tx queue sets up both queues, release_queue close the > tap file but update file descriptor only for that queue. >=20 > This makes other queue's file descriptor invalid. >=20 > As a workaround, prevent release_queue callback to be called by default. >=20 > This is done by separating Rx/Tx setup functions, so that each only > setup its own queue, this prevents rte_eth_rx/tx_queue_setup() calling > release_queue before setup_queue. >=20 > Signed-off-by: Keith Wiles > Signed-off-by: Ferruh Yigit Acked-by: Keith Wiles > --- > drivers/net/tap/rte_eth_tap.c | 26 ++++++++++++++++++++++---- > 1 file changed, 22 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.= c > index c0afc2d..91f63f5 100644 > --- a/drivers/net/tap/rte_eth_tap.c > +++ b/drivers/net/tap/rte_eth_tap.c > @@ -428,8 +428,6 @@ tap_setup_queue(struct rte_eth_dev *dev, > } > } > } > - dev->data->rx_queues[qid] =3D rx; > - dev->data->tx_queues[qid] =3D tx; >=20 > rx->fd =3D fd; > tx->fd =3D fd; > @@ -438,6 +436,26 @@ tap_setup_queue(struct rte_eth_dev *dev, > } >=20 > static int > +rx_setup_queue(struct rte_eth_dev *dev, > + struct pmd_internals *internals, > + uint16_t qid) > +{ > + dev->data->rx_queues[qid] =3D &internals->rxq[qid]; > + > + return tap_setup_queue(dev, internals, qid); > +} > + > +static int > +tx_setup_queue(struct rte_eth_dev *dev, > + struct pmd_internals *internals, > + uint16_t qid) > +{ > + dev->data->tx_queues[qid] =3D &internals->txq[qid]; > + > + return tap_setup_queue(dev, internals, qid); > +} > + > +static int > tap_rx_queue_setup(struct rte_eth_dev *dev, > uint16_t rx_queue_id, > uint16_t nb_rx_desc __rte_unused, > @@ -469,7 +487,7 @@ tap_rx_queue_setup(struct rte_eth_dev *dev, > return -ENOMEM; > } >=20 > - fd =3D tap_setup_queue(dev, internals, rx_queue_id); > + fd =3D rx_setup_queue(dev, internals, rx_queue_id); > if (fd =3D=3D -1) > return -1; >=20 > @@ -493,7 +511,7 @@ tap_tx_queue_setup(struct rte_eth_dev *dev, > if (tx_queue_id >=3D internals->nb_queues) > return -1; >=20 > - ret =3D tap_setup_queue(dev, internals, tx_queue_id); > + ret =3D tx_setup_queue(dev, internals, tx_queue_id); > if (ret =3D=3D -1) > return -1; >=20 > --=20 > 2.9.3 >=20 Regards, Keith