From patchwork Tue May 12 14:14:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Squyres X-Patchwork-Id: 6388591 X-Patchwork-Delegate: dledford@redhat.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D87E5BEEE1 for ; Tue, 12 May 2015 14:14:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EA4A20414 for ; Tue, 12 May 2015 14:14:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21BC820412 for ; Tue, 12 May 2015 14:14:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932545AbbELOOf (ORCPT ); Tue, 12 May 2015 10:14:35 -0400 Received: from rcdn-iport-5.cisco.com ([173.37.86.76]:36123 "EHLO rcdn-iport-5.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932509AbbELOOf (ORCPT ); Tue, 12 May 2015 10:14:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1920; q=dns/txt; s=iport; t=1431440075; x=1432649675; h=from:to:cc:subject:date:message-id; bh=VuZBOkVKhE6ArFKp/KUkt7WK3bxuZWvpBqkaNkEml9A=; b=ZDzqCLwI8q9RavGZdxa9VquUw0OPI1cxtm1x/p5jUj3E5OuNHcQa66JU PSE56QBYPIJo9UGhWSA2itc9XWEQggBaDWYogEDS/FeFU29eFJqSFkF1G V1/hcuk4ESxGWQ0keU7zc0KgDPmSR/h1T0x9MWtTG0gZamlGGjA2hJiXS M=; X-IronPort-AV: E=Sophos;i="5.13,415,1427760000"; d="scan'208";a="419043569" Received: from alln-core-12.cisco.com ([173.36.13.134]) by rcdn-iport-5.cisco.com with ESMTP; 12 May 2015 14:14:35 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-12.cisco.com (8.14.5/8.14.5) with ESMTP id t4CEEYu1002931; Tue, 12 May 2015 14:14:34 GMT Received: by cisco.com (Postfix, from userid 182726) id 4E2E53FAAC5E; Tue, 12 May 2015 07:14:34 -0700 (PDT) From: Jeff Squyres To: linux-rdma@vger.kernel.org Cc: Jeff Squyres Subject: [PATCH v3] libibverbs init.c: conditionally emit warning if no userspace driver found Date: Tue, 12 May 2015 07:14:28 -0700 Message-Id: <1431440068-19037-1-git-send-email-jsquyres@cisco.com> X-Mailer: git-send-email 2.2.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's not a warning or an error if libibverbs cannot find a userspace driver for kernel devices. Indeed, returning a num_devices of is sufficient -- the middleware shouldn't be unconditionally printing out stderr message; let the upper layer application do that (if it wants to). For debugging purposes, if the environment variable IBV_SHOW_WARNINGS is set (to any value), warnings will be emitted to stderr if a corresponding userspace driver cannot be found for a kernel device. Signed-off-by: Jeff Squyres --- man/ibv_get_device_list.3 | 6 ++++++ src/init.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/man/ibv_get_device_list.3 b/man/ibv_get_device_list.3 index 16cc1a0..96de554 100644 --- a/man/ibv_get_device_list.3 +++ b/man/ibv_get_device_list.3 @@ -50,6 +50,12 @@ Client code should open all the devices it intends to use with Once it frees the array with .B ibv_free_device_list()\fR, it will be able to use only the open devices; pointers to unopened devices will no longer be valid. +.P +Setting the environment variable +.BR IBV_SHOW_WARNINGS +will cause warnings to be emitted to stderr if a kernel verbs device +is discovered, but no corresponding userspace driver can be found for +it. .SH "SEE ALSO" .BR ibv_fork_init (3), .BR ibv_get_device_name (3), diff --git a/src/init.c b/src/init.c index d0e4b1c..dbdd795 100644 --- a/src/init.c +++ b/src/init.c @@ -561,7 +561,7 @@ out: next_dev = sysfs_dev ? sysfs_dev->next : NULL; sysfs_dev; sysfs_dev = next_dev, next_dev = sysfs_dev ? sysfs_dev->next : NULL) { - if (!sysfs_dev->have_driver) { + if (!sysfs_dev->have_driver && getenv("IBV_SHOW_WARNINGS")) { fprintf(stderr, PFX "Warning: no userspace device-specific " "driver found for %s\n", sysfs_dev->sysfs_path); if (statically_linked)