From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) by dpdk.org (Postfix) with ESMTP id 7E4E11F7 for ; Fri, 27 Feb 2015 19:27:06 +0100 (CET) Received: by wesu56 with SMTP id u56so21977550wes.10 for ; Fri, 27 Feb 2015 10:27:06 -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; bh=auFDDtf0cWGuHZvbA5Tzuc4g1YQnqkPS9zD9Cmc1nk4=; b=SEyOcWQrP+cX8gHfluvkss/GzY5zoBe4EiUFaHyecztKR0LhjlnunAKipROAXIA3v+ AIaPxBqZP7bdZ4sessl33mhGWkVrMXV0ETkMfmLaJYUiyYd6pdptLZcgrOltNKiwK1dZ 3e9qouBNoSyIzTzxO0QFWDE9A1mSBwoYDN6RD1O9OJB/1CcBdAF14/p0j+qdKi0O92Vu etrIrz/g99o10n5nGLfnRRStuk9X4bSP645SkAP3Rig9rJfzrvri+RP4HU8VAduSY2CE 1prSPdgjme6GAI56ppAGPqCLNFFlGB+gaHB2Kaay8Ts5QhqMnje1P8zBlGOFsF1UTTCi xRNQ== X-Gm-Message-State: ALoCoQl9ct3EAqPCO9/Bz8hHSDoyD6q6qSb/Y6e06B2CQibaPY8/sMM8fCJ5LMs0vMuMGeqCxfUa X-Received: by 10.194.95.66 with SMTP id di2mr30609985wjb.57.1425061626319; Fri, 27 Feb 2015 10:27:06 -0800 (PST) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id vh8sm7059748wjc.12.2015.02.27.10.27.05 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 27 Feb 2015 10:27:05 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Fri, 27 Feb 2015 19:27:00 +0100 Message-Id: <1425061620-2901-1-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.0 Subject: [dpdk-dev] [PATCH] mlx4: avoid init errors when kernel modules are not loaded 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: Fri, 27 Feb 2015 18:27:06 -0000 Mimic UIO/VFIO drivers behavior by not causing errors when a device cannot be initialized due to missing or mismatching kernel modules. Display helpful messages instead, such as: [...] EAL: PCI device 0000:83:00.0 on NUMA socket 1 EAL: probe driver: 15b3:1007 librte_pmd_mlx4 PMD: librte_pmd_mlx4: PCI information matches, using device "mlx4_0" (VF: false) PMD: librte_pmd_mlx4: cannot use device, are drivers up to date? EAL: PCI device 0000:84:00.0 on NUMA socket 1 EAL: probe driver: 15b3:1007 librte_pmd_mlx4 PMD: librte_pmd_mlx4: PCI information matches, using device "mlx4_1" (VF: false) PMD: librte_pmd_mlx4: cannot use device, are drivers up to date? EAL: No probed ethernet devices [...] Signed-off-by: Adrien Mazarguil --- lib/librte_pmd_mlx4/mlx4.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/librte_pmd_mlx4/mlx4.c b/lib/librte_pmd_mlx4/mlx4.c index 492cbbf..12d9379 100644 --- a/lib/librte_pmd_mlx4/mlx4.c +++ b/lib/librte_pmd_mlx4/mlx4.c @@ -4425,6 +4425,10 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) list = ibv_get_device_list(&i); if (list == NULL) { assert(errno); + if (errno == ENOSYS) { + WARN("cannot list devices, is ib_uverbs loaded?"); + return 0; + } return -errno; } assert(i >= 0); @@ -4453,9 +4457,15 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) break; } if (attr_ctx == NULL) { - if (err == 0) - err = ENODEV; ibv_free_device_list(list); + switch (err) { + case 0: + WARN("cannot access device, is mlx4_ib loaded?"); + return 0; + case EINVAL: + WARN("cannot use device, are drivers up to date?"); + return 0; + } assert(err > 0); return -err; } -- 2.1.0