From patchwork Fri Jan 8 20:29:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 59396 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp754601lbb; Fri, 8 Jan 2016 11:45:37 -0800 (PST) X-Received: by 10.55.76.11 with SMTP id z11mr145652477qka.83.1452282336473; Fri, 08 Jan 2016 11:45:36 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 39si68933512qgo.127.2016.01.08.11.45.36; Fri, 08 Jan 2016 11:45:36 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EFA106179B; Fri, 8 Jan 2016 19:45:35 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=abahvea9; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 296BE61CE5; Fri, 8 Jan 2016 19:33:52 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B72D2617AB; Fri, 8 Jan 2016 19:33:38 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by lists.linaro.org (Postfix) with ESMTPS id 1163C617AF for ; Fri, 8 Jan 2016 19:31:47 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id oh2so230053186lbb.3 for ; Fri, 08 Jan 2016 11:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=efj7jH85RdTl7LXf9Rq+KgK8f8dq8ksClD7gB7Fw6Y8=; b=abahvea9M7DAXyICKu6dx93bPBpfUaTN7uOQXTgNyZO3Vd/NHsa5nUlXuhQf2qpk6W X6ov/GjDwm7B1m6y9RT2pkrfZBwObOxG4LdydtjSAZWPBLWmVlh9RIvr4glzBcHhDvmx Nz7SylHXfuTWNi+rt7nrK6c+ZxT8B0OgQDwkw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=efj7jH85RdTl7LXf9Rq+KgK8f8dq8ksClD7gB7Fw6Y8=; b=aKf9SeaVY4mdNWWpUtdrTIvCQUzO9pVVjK/Hw2voqpGqvQyD4aip//eGmjL9D32ElA iAYUl4Y7pEJzcaaGEheC+ebatREdW/DnsbZv5y/GvbOzVIlEzGqWv3aHVeTUSedMGTR/ 1MNfVnqKG3eRlfrZrW4biY7NSl3+mf6/eOsJbdBRwutVpe83V09XidggT/BwpZOaihm4 kc1ZyAaYtlDOm/GWw9nbaw9pSU2bBvqFjUNVyiehZrekx7riqgEgBv7ta4ReuiItlpV4 0Z3KIkcsKIRQ3BFCCzoHZIausvR5Iky4SlOsjN1/gssykuCPNux901nQPayfiZH83Abt b/gA== X-Gm-Message-State: ALoCoQmUbqhZ9VRSeZw8cHu68rpGYqriMjUZr1f8pJvSGP5Uh3HKCyDFYkQoYAoQbjyNBhepJ1nsrpewEEgqLBbzQ5Ge+h4nrQ== X-Received: by 10.112.168.5 with SMTP id zs5mr16905549lbb.56.1452281506008; Fri, 08 Jan 2016 11:31:46 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-90-46.cust.bredband2.com. [83.233.90.46]) by smtp.gmail.com with ESMTPSA id l204sm2085534lfg.49.2016.01.08.11.31.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jan 2016 11:31:45 -0800 (PST) From: Christophe Milard To: anders.roxell@linaro.org, mike.holmes@linaro.org, stuart.haslam@linaro.org, maxim.uvarov@linaro.org, bill.fischofer@linaro.org, petri.savolainen@linaro.org, edavis@broadcom.com Date: Fri, 8 Jan 2016 21:29:54 +0100 Message-Id: <1452285014-60320-12-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452285014-60320-1-git-send-email-christophe.milard@linaro.org> References: <1452285014-60320-1-git-send-email-christophe.milard@linaro.org> Cc: lng-odp@lists.linaro.org Subject: [lng-odp] [API-NEXT RFC 11/31] defining the location for ODP drivers X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" ODP nic drivers should be OS and platform agnosic (the only assumption being that pci is available through the odp pci interface, and the availability the the C lib). The drivers are hence placed directely into /drivers. This also defines the driver compilation option: --enable-drivers which should be used to compiles the ODP nic drivers with ODP. Signed-off-by: Christophe Milard --- Makefile.am | 6 +++++- configure.ac | 16 ++++++++++++++++ drivers/Makefile.am | 6 ++++++ drivers/README | 1 + drivers/driver_init.c | 11 +++++++++++ drivers/driver_init.h | 7 +++++++ drivers/m4/configure.m4 | 3 +++ platform/linux-generic/Makefile.am | 11 +++++++++++ 8 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 drivers/Makefile.am create mode 100644 drivers/README create mode 100644 drivers/driver_init.c create mode 100644 drivers/driver_init.h create mode 100644 drivers/m4/configure.m4 diff --git a/Makefile.am b/Makefile.am index 2acbe3d..66b7431 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,11 @@ AM_DISTCHECK_CONFIGURE_FLAGS = --enable-test-cpp \ --with-testdir #@with_platform@ works alone in subdir but not as part of a path??? -SUBDIRS = @platform_with_platform@ \ +SUBDIRS = +if WITH_DRIVERS +SUBDIRS += drivers +endif +SUBDIRS += @platform_with_platform@ \ helper \ test \ @platform_with_platform_test@ \ diff --git a/configure.ac b/configure.ac index 4f89f03..52efaef 100644 --- a/configure.ac +++ b/configure.ac @@ -135,6 +135,22 @@ AC_ARG_ENABLE([cunit_support], cunit_support=yes fi]) +########################################################################## +# Enable NIC driver support +########################################################################## +nic_driver_support=no +AC_ARG_ENABLE([drivers], + [ --enable-drivers include NIC drivers], + [if test x$enableval = xyes; then + nic_driver_support=yes + fi]) +AM_CONDITIONAL([WITH_DRIVERS], [test x$nic_driver_support = xyes ]) + +if test "x$nic_driver_support" == "xyes"; +then + AM_CFLAGS="$AM_CFLAGS -DWITH_DRIVERS" + m4_include([./drivers/m4/configure.m4]) +fi ########################################################################## # Setup doxygen documentation diff --git a/drivers/Makefile.am b/drivers/Makefile.am new file mode 100644 index 0000000..9f922a8 --- /dev/null +++ b/drivers/Makefile.am @@ -0,0 +1,6 @@ +INCFLAGS = -I$(top_srcdir)/platform/@with_platform@/include \ + -I$(top_srcdir)/platform/linux-generic/include \ + -I$(top_srcdir)/include + +noinst_LTLIBRARIES = libdrivers.la +libdrivers_la_SOURCES = driver_init.c diff --git a/drivers/README b/drivers/README new file mode 100644 index 0000000..54d2d37 --- /dev/null +++ b/drivers/README @@ -0,0 +1 @@ +This is the directory for ODP drivers diff --git a/drivers/driver_init.c b/drivers/driver_init.c new file mode 100644 index 0000000..acacffa --- /dev/null +++ b/drivers/driver_init.c @@ -0,0 +1,11 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "driver_init.h" +void _odp_driver_init(void) +{ + /* call each driver init function here */ +} diff --git a/drivers/driver_init.h b/drivers/driver_init.h new file mode 100644 index 0000000..a8710ab --- /dev/null +++ b/drivers/driver_init.h @@ -0,0 +1,7 @@ +/* Copyright (c) 2015, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +void _odp_driver_init(void); diff --git a/drivers/m4/configure.m4 b/drivers/m4/configure.m4 new file mode 100644 index 0000000..cca047a --- /dev/null +++ b/drivers/m4/configure.m4 @@ -0,0 +1,3 @@ +AC_CONFIG_FILES([ + drivers/Makefile + ]) diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 999c932..a070cb3 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -7,6 +7,10 @@ AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(top_srcdir)/include AM_CFLAGS += -I$(top_srcdir)/helper/include +if WITH_DRIVERS +AM_CFLAGS += -I$(top_srcdir)/drivers +endif + include_HEADERS = \ $(top_srcdir)/include/odp.h @@ -119,6 +123,9 @@ noinst_HEADERS = \ ${srcdir}/include/odp_timer_wheel_internal.h \ ${srcdir}/include/odp_traffic_mngr_internal.h \ ${srcdir}/Makefile.inc +if WITH_DRIVERS +noinst_HEADERS += $(top_srcdir)/drivers/driver_init.h +endif __LIB__libodp_la_SOURCES = \ odp_atomic.c \ @@ -178,3 +185,7 @@ EXTRA_DIST = \ if HAVE_PCAP __LIB__libodp_la_SOURCES += pktio/pcap.c endif + +if WITH_DRIVERS +__LIB__libodp_la_LIBADD = $(top_srcdir)/drivers/libdrivers.la +endif