From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by dpdk.org (Postfix) with ESMTP id 96A6B2A7 for ; Wed, 10 Jul 2013 15:15:39 +0200 (CEST) Received: by mail-wi0-f171.google.com with SMTP id hj3so11377048wib.10 for ; Wed, 10 Jul 2013 06:15:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references:x-gm-message-state; bh=7Dk1Qfa00Nf5ifPnCNUjnLVPfSqW8fkPmjreHnw40fk=; b=EG3xoXI511pxjuFV3zJ0+QC5WbLtfYl2PS/stfS08HF8A9Y3lY0kVljttGQaLnydCF 70USvIMwVAsOxXk17Xjy7INMoensqdeI+ABS6Ax9gjgyYRj6Ba0oHVcSrmE8mhJ8cZaR 9ZdJ5JuQENBAvSeQX1VB5HBAUH4R7RsjIQULmpaNy8z+ojI8WUlbWUrta36c+i89jL4L QrOUD/QSqG+zmmT2UFXuMdV8cQm4nMqN2per54mZid9/VUDW73ZUFL0YJ1Ljs8gEBfe/ zzOQFN/8UjJL/fFkLHXKf6vGvug4VmgQ9Uc1gb6YpJUPKdb2I2KBNvcKkmVfBrI5iyT8 Aq1g== X-Received: by 10.194.123.69 with SMTP id ly5mr17942059wjb.29.1373462157560; Wed, 10 Jul 2013 06:15:57 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id d8sm36028928wiz.0.2013.07.10.06.15.55 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 10 Jul 2013 06:15:56 -0700 (PDT) From: Damien Millescamps To: dev@dpdk.org Date: Wed, 10 Jul 2013 15:14:52 +0200 Message-Id: <0f890bf9b880233a2af4844f78ccef07c5018c98.1373462050.git.damien.millescamps@6wind.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmIwerAgyZMBqSLEt2+UGnhITJkNk5Znuv1BVWiu8bh0kzhhNuBueQfta9Bzn4vyrfnbaHg Subject: [dpdk-dev] [PATCH 1/2] eal: add flag to force unbind device 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, 10 Jul 2013 13:15:39 -0000 Some devices need to be unbound in order to be used via the PMD without kernel module. Signed-off-by: Damien Millescamps --- lib/librte_eal/common/include/rte_pci.h | 2 ++ lib/librte_eal/linuxapp/eal/eal_pci.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index c3937f0..6582c25 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -157,6 +157,8 @@ struct rte_pci_driver { #define RTE_PCI_DRV_NEED_IGB_UIO 0x0001 /** Device driver must be registered several times until failure */ #define RTE_PCI_DRV_MULTIPLE 0x0002 +/** Device needs to be unbound even if no module is provided */ +#define RTE_PCI_DRV_FORCE_UNBIND 0x0004 /** * Probe the PCI bus for registered drivers. diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index 882fd6f..1d087b8 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -745,6 +745,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d /* map the NIC resources */ if (pci_uio_map_resource(dev) < 0) return -1; + } else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND && + rte_eal_process_type() == RTE_PROC_PRIMARY) { + /* unbind current driver, bind ours */ + if (pci_unbind_kernel_driver(dev) < 0) + return -1; } /* reference driver structure */ -- 1.7.2.5