From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E637EB38D for ; Wed, 27 Aug 2014 19:24:23 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 27 Aug 2014 10:27:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,412,1406617200"; d="scan'208";a="590698206" Received: from fmsmsx103.amr.corp.intel.com ([10.19.9.34]) by fmsmga002.fm.intel.com with ESMTP; 27 Aug 2014 10:27:09 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.19.9.29) by FMSMSX103.amr.corp.intel.com (10.19.9.34) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 27 Aug 2014 10:27:08 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx120.amr.corp.intel.com (10.19.9.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 27 Aug 2014 10:27:07 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.198]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.17]) with mapi id 14.03.0195.001; Thu, 28 Aug 2014 01:27:00 +0800 From: "Xie, Huawei" To: David Marchand , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH RFC 2/3] eal: don't call rte_eal_iopl_init unconditionnally Thread-Index: AQHPwTfZIKzaNPehxkGPAQovJ2IJ5pvktAZQ Date: Wed, 27 Aug 2014 17:26:59 +0000 Message-ID: References: <1409062300-17004-1-git-send-email-david.marchand@6wind.com> <1409062300-17004-3-git-send-email-david.marchand@6wind.com> In-Reply-To: <1409062300-17004-3-git-send-email-david.marchand@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH RFC 2/3] eal: don't call rte_eal_iopl_init unconditionnally 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: Wed, 27 Aug 2014 17:24:24 -0000 Acked-by: Huawei Xie > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of David Marchand > Sent: Tuesday, August 26, 2014 10:12 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH RFC 2/3] eal: don't call rte_eal_iopl_init > unconditionnally >=20 > There is no need for ioport access for applications that won't use virtio= pmds. > Make rte_eal_iopl_init() non-static so that it is called from pmds that n= eed it. >=20 > Signed-off-by: David Marchand > --- > lib/librte_eal/bsdapp/eal/eal.c | 5 +---- > lib/librte_eal/common/include/rte_eal.h | 14 +++++++++++--- > lib/librte_eal/linuxapp/eal/eal.c | 11 ++++------- > lib/librte_pmd_virtio/virtio_ethdev.c | 15 ++++++++------- > 4 files changed, 24 insertions(+), 21 deletions(-) >=20 > diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/= eal.c > index 0697b05..dad9e0c 100644 > --- a/lib/librte_eal/bsdapp/eal/eal.c > +++ b/lib/librte_eal/bsdapp/eal/eal.c > @@ -803,7 +803,7 @@ int rte_eal_has_hugepages(void) > } >=20 > /* Abstraction for port I/0 privilege */ > -static int > +int > rte_eal_iopl_init(void) > { > int fd =3D -1; > @@ -864,9 +864,6 @@ rte_eal_init(int argc, char **argv) >=20 > rte_config_init(); >=20 > - if (rte_eal_iopl_init() =3D=3D 0) > - rte_config.flags |=3D EAL_FLG_HIGH_IOPL; > - > if (rte_eal_cpu_init() < 0) > rte_panic("Cannot detect lcores\n"); >=20 > diff --git a/lib/librte_eal/common/include/rte_eal.h > b/lib/librte_eal/common/include/rte_eal.h > index 273da9a..8d39cba 100644 > --- a/lib/librte_eal/common/include/rte_eal.h > +++ b/lib/librte_eal/common/include/rte_eal.h > @@ -88,9 +88,6 @@ struct rte_config { > struct rte_mem_config *mem_config; > } __attribute__((__packed__)); >=20 > -/* Flag definitions for rte_config flags */ > -#define EAL_FLG_HIGH_IOPL 1 /**< indicates high IO privilege in a linux = env */ > - > /** > * Get the global configuration structure. > * > @@ -119,6 +116,17 @@ enum rte_lcore_role_t rte_eal_lcore_role(unsigned > lcore_id); > enum rte_proc_type_t rte_eal_process_type(void); >=20 > /** > + * Request iopl privilege for all RPL. > + * > + * This function should be called by pmds which need access to ioports. > + > + * @return > + * - On success, returns 0. > + * - On failure, returns -1. > + */ > +int rte_eal_iopl_init(void); > + > +/** > * Initialize the Environment Abstraction Layer (EAL). > * > * This function is to be executed on the MASTER lcore only, as soon > diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/= eal/eal.c > index 2940e69..884aa9b 100644 > --- a/lib/librte_eal/linuxapp/eal/eal.c > +++ b/lib/librte_eal/linuxapp/eal/eal.c > @@ -107,8 +107,6 @@ >=20 > #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10) >=20 > -#define HIGHEST_RPL 3 > - > #define BITS_PER_HEX 4 >=20 > /* Allow the application to print its usage message too if set */ > @@ -1060,10 +1058,12 @@ rte_eal_mcfg_complete(void) > /* > * Request iopl privilege for all RPL, returns 0 on success > */ > -static int > +int > rte_eal_iopl_init(void) > { > - return iopl(HIGHEST_RPL); > + if (iopl(3) !=3D 0) > + return -1; > + return 0; > } >=20 > /* Launch threads, called at application init(). */ > @@ -1125,9 +1125,6 @@ rte_eal_init(int argc, char **argv) >=20 > rte_config_init(); >=20 > - if (rte_eal_iopl_init() =3D=3D 0) > - rte_config.flags |=3D EAL_FLG_HIGH_IOPL; > - > if (rte_eal_pci_init() < 0) > rte_panic("Cannot init PCI\n"); >=20 > diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c > b/lib/librte_pmd_virtio/virtio_ethdev.c > index 3344ffb..587b746 100644 > --- a/lib/librte_pmd_virtio/virtio_ethdev.c > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c > @@ -736,12 +736,6 @@ eth_virtio_dev_init(__rte_unused struct eth_driver > *eth_drv, > return -1; > } >=20 > - if (!(rte_eal_get_configuration()->flags & EAL_FLG_HIGH_IOPL)) { > - PMD_INIT_LOG(ERR, > - "IOPL call failed in EAL init - cannot use virtio PMD > driver\n"); > - return -1; > - } > - > eth_dev->dev_ops =3D &virtio_eth_dev_ops; > eth_dev->tx_pkt_burst =3D &virtio_xmit_pkts; >=20 > @@ -896,8 +890,15 @@ static struct eth_driver rte_virtio_pmd =3D { > * Returns 0 on success. > */ > static int > -rte_virtio_pmd_init(const char *name __rte_unused, const char *param > __rte_unused) > +rte_virtio_pmd_init(const char *name __rte_unused, > + const char *param __rte_unused) > { > + if (rte_eal_iopl_init() !=3D 0) { > + PMD_INIT_LOG(ERR, "IOPL call failed - " > + "cannot use virtio PMD driver\n"); > + return -1; > + } > + > rte_eth_driver_register(&rte_virtio_pmd); > return 0; > } > -- > 1.7.10.4