From patchwork Mon Nov 7 11:15:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Milard X-Patchwork-Id: 81025 Delivered-To: patch@linaro.org Received: by 10.182.113.165 with SMTP id iz5csp1029464obb; Mon, 7 Nov 2016 02:16:55 -0800 (PST) X-Received: by 10.55.106.134 with SMTP id f128mr2765341qkc.121.1478513815198; Mon, 07 Nov 2016 02:16:55 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q35si15571653qtc.150.2016.11.07.02.16.54; Mon, 07 Nov 2016 02:16:55 -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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id DC0EC60A55; Mon, 7 Nov 2016 10:16:54 +0000 (UTC) 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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 323E360D0B; Mon, 7 Nov 2016 10:16:24 +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 C8C6960CED; Mon, 7 Nov 2016 10:16:13 +0000 (UTC) Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by lists.linaro.org (Postfix) with ESMTPS id A649060A55 for ; Mon, 7 Nov 2016 10:16:11 +0000 (UTC) Received: by mail-lf0-f47.google.com with SMTP id c13so109176046lfg.0 for ; Mon, 07 Nov 2016 02:16:11 -0800 (PST) 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=Fq0sIb0bFdnzX/7DVwSOrIllR7Xf2+EJkZHG6YPtNFQ=; b=CGenIYh4yw1oNKeQIB7ARFDIZN84fTcgqKmkfIsu5UaDfM5747vF10exF0SStyc+Wl dTM8SvYYYKFRujyZmremLqpZVYiWLs/ge0FoD4FUk7+mmS/JyHYKc4FETeSMqMfPDeFF NfBh9KuCIT3W2vmLu0vUZXyMF8oHMI1kjP6MLHg0jb/FIyZXz6pPrPPZJZI6Aown35Lc ufuJEgjKjLlNlHhbvqA7e6Y6hDwQrhOZa5ICHcAeyLbOLxuOQr2Zwr/s1n3hyCIQkAh+ Vx6FNgRXOJYEyeRS9Yi+AD5zalMnLoo3fPbj7NWya9TW7Z+sehEZgCpFrR+m1hnYKX7r wllQ== X-Gm-Message-State: ABUngvdNmwTD1A6JVmLFcl+zaGwijvPvkeCY5L2hfqdp0rn1qkuHFwcWuSkgIGxx/US4/1maqDk= X-Received: by 10.25.221.82 with SMTP id u79mr2983773lfg.52.1478513770385; Mon, 07 Nov 2016 02:16:10 -0800 (PST) Received: from erachmi-ericsson.ki.sw.ericsson.se (c-83-233-76-66.cust.bredband2.com. [83.233.76.66]) by smtp.gmail.com with ESMTPSA id w67sm4932592lff.16.2016.11.07.02.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Nov 2016 02:16:09 -0800 (PST) From: Christophe Milard To: yi.he@linaro.org, mike.holmes@linaro.org, bill.fischofer@linaro.org, lng-odp@lists.linaro.org Date: Mon, 7 Nov 2016 12:15:20 +0100 Message-Id: <1478517324-11324-2-git-send-email-christophe.milard@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478517324-11324-1-git-send-email-christophe.milard@linaro.org> References: <1478517324-11324-1-git-send-email-christophe.milard@linaro.org> X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2 1/5] drv: adding driver registration interface (stub) 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" The driver registration function (and a draft of its parameters) is defined, the goal being to define the driver registration framework only. Signed-off-by: Christophe Milard --- include/odp/drv/spec/driver.h | 76 +++++++++++++++++++++++++++++++++++++++++++ platform/Makefile.inc | 1 + 2 files changed, 77 insertions(+) create mode 100644 include/odp/drv/spec/driver.h -- 2.7.4 diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h new file mode 100644 index 0000000..406112b --- /dev/null +++ b/include/odp/drv/spec/driver.h @@ -0,0 +1,76 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODPDRV driver + */ + +#ifndef ODPDRV_DRIVER_H_ +#define ODPDRV_DRIVER_H_ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup odpdrv_driver + * @details + * NIC driver interface to ODP + * + * @{ + */ + +/** + * Different busses drivers can handle: + */ +typedef enum odpdrv_bus_t { + ODPDRV_BUS_UNKNOWN, /**< error case: no driver should use that */ + ODPDRV_BUS_PCI /**< pci bus, for all kind of pci drivers */ +} odpdrv_bus_t; + +/** + * Different driver types + */ +typedef enum odpdrv_driver_types_t { + ODPDRV_UNKNOWN_TYPE, /**< error case: no driver should use that */ + ODPDRV_PCI_VIRTIO, /**< pci virtio driver */ + ODPDRV_PCI_VFIO /**< pci_vfio: vfio interface required */ +} odpdrv_driver_type_t; + +/** + * Parameter to be given at driver registration: + */ +typedef struct odpdrv_driver_param_t { + const char *name; /**< Driver name. */ + odpdrv_bus_t bus; /**< Driver bus. */ + odpdrv_driver_type_t type; /**< Driver type. */ +} odpdrv_driver_param_t; + +/** + * Register a Driver. + * A call to this function should be made by all drivers at init time. + * (called by an init function in the driver, probably using gcc/clang + * __constructor__ attribute. + * + * @param drv_param Pointer to a driver registration structure. + * @return 0 on success, non-zero on error. On error, drivers + * should release allocated resources and return. + */ +int odpdrv_driver_register(odpdrv_driver_param_t *drv_param); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#include +#endif diff --git a/platform/Makefile.inc b/platform/Makefile.inc index b31b95b..69ee878 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -67,6 +67,7 @@ odpdrvspecinclude_HEADERS = \ $(top_srcdir)/include/odp/drv/spec/barrier.h \ $(top_srcdir)/include/odp/drv/spec/byteorder.h \ $(top_srcdir)/include/odp/drv/spec/compiler.h \ + $(top_srcdir)/include/odp/drv/spec/driver.h \ $(top_srcdir)/include/odp/drv/spec/shm.h \ $(top_srcdir)/include/odp/drv/spec/spinlock.h \ $(top_srcdir)/include/odp/drv/spec/std_types.h \