From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id C58C87CD7 for ; Wed, 24 May 2017 17:05:40 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id z52so56849731wrc.2 for ; Wed, 24 May 2017 08:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=rVIquK6g39GXB+PAUaCvUXnf/ZlJs1+/8zLYQLgcryk=; b=Tz6Ly4MOUstgR2DrH0KSLRrd5IMpINu7TmH/tKlXDkUYA+zvWNwvaHSVk57lIKTcFl xkeQwm+ftTwo3+b8LTFfE4Is0P9ERxcyx1sv5Ptivvs8AvvkKkpQ0jiQArZg3uLw6DOP iS31sCbeAaVLERNu5bANvE/iI3SLraWPnAtutVOKZnEPUIPnknybLcoslNqz8sEQ/bGp h+Hbv0LFTcKql4P8UkR6kYbRmWlgYMPspG3sICSCHGaPEhZGhdTKCyZTmdpZ9jAlLN7j pzXBYy3obBJeaLW1HpDZxEsqKffjPInf5Sbn/hjTDdzycPuKaHqM6KnINxoUR1+7E9Op 7vtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=rVIquK6g39GXB+PAUaCvUXnf/ZlJs1+/8zLYQLgcryk=; b=i9yPWHi4kc615XwcRsg+GIqqjEsI9rycq0RtDYeu0xaJ73vEdIeSe+UlZI1kG9/XQM BLiS7CduMwxoPdV48yeXfYAiOJgQmTW7rP9xvNiKbQmJWk/6FypgXiJfl6/QL2gEmjTj 8nrZyhuVWYp5AcunxPt6gdwMPmIR/dmgiuIQlT4OKuLzyXpUNC7eCnaYve7vWsMIg3rC SlkEO9sojcHL9AjmvClOCnuRw5i2oN3XXtyRVqVxPw9NnBoED8W92rZeiUz4KTVxSSM1 tzj+A4Y707nMVYYfJLIusUtszXZioWJGkiOIGF+NZnjKOGd7PxIZ2G6PyG4UAwKDmJlF ORFA== X-Gm-Message-State: AODbwcCKAzsCIz4jQ6kvEFvtNJEWob9V/V+CdSLX4dEm01VYn3c0zsv+ OwJfvUJ5ania9AYn X-Received: by 10.223.133.35 with SMTP id 32mr19700806wrh.200.1495638340522; Wed, 24 May 2017 08:05:40 -0700 (PDT) Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 25sm4076017wrz.8.2017.05.24.08.05.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 May 2017 08:05:39 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Jan Blunck Date: Wed, 24 May 2017 17:04:57 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 5/9] bus: introduce attach/detach functionality 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: Wed, 24 May 2017 15:05:41 -0000 From: Jan Blunck Signed-off-by: Jan Blunck --- lib/librte_eal/common/eal_common_bus.c | 3 +++ lib/librte_eal/common/include/rte_bus.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c index b8f8384..9fda287 100644 --- a/lib/librte_eal/common/eal_common_bus.c +++ b/lib/librte_eal/common/eal_common_bus.c @@ -52,6 +52,9 @@ rte_bus_register(struct rte_bus *bus) RTE_VERIFY(bus->probe); RTE_VERIFY(bus->find_device); + /* Buses supporting attach also require detach */ + RTE_VERIFY(!bus->attach || bus->detach); + TAILQ_INSERT_TAIL(&rte_bus_list, bus, next); RTE_LOG(DEBUG, EAL, "Registered [%s] bus.\n", bus->name); } diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h index 3b22fb8..201b0ff 100644 --- a/lib/librte_eal/common/include/rte_bus.h +++ b/lib/librte_eal/common/include/rte_bus.h @@ -89,6 +89,20 @@ typedef struct rte_device * (*rte_bus_find_device_t)( const void *data); /** + * Implementation specific probe function which is responsible for linking + * devices on that bus with applicable drivers. + * + */ +typedef int (*rte_bus_attach_t)(struct rte_device *dev); + +/** + * Implementation specific remove function which is responsible for unlinking + * devices on that bus from assigned driver. + * + */ +typedef int (*rte_bus_detach_t)(struct rte_device *dev); + +/** * A structure describing a generic bus. */ struct rte_bus { @@ -97,6 +111,8 @@ struct rte_bus { rte_bus_scan_t scan; /**< Scan for devices attached to bus */ rte_bus_probe_t probe; /**< Probe devices on bus */ rte_bus_find_device_t find_device; /**< Find device on bus */ + rte_bus_attach_t attach; /**< Probe single device for drivers */ + rte_bus_detach_t detach; /**< Remove single device from driver */ }; /** -- 2.1.4