From owner-freebsd-hackers@FreeBSD.ORG Tue May 27 02:18:21 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9308FE8C for ; Tue, 27 May 2014 02:18:21 +0000 (UTC) Received: from mail-oa0-x236.google.com (mail-oa0-x236.google.com [IPv6:2607:f8b0:4003:c02::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6147A2173 for ; Tue, 27 May 2014 02:18:21 +0000 (UTC) Received: by mail-oa0-f54.google.com with SMTP id j17so8884453oag.13 for ; Mon, 26 May 2014 19:18:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=vSbb5y7Yi+7CKg9UXKnMblh4qLqJsejbD6A3OiNHNKM=; b=WGuK7dkB5vwtSo5nrQM/q0hY5gakN+tWYRovFXpomfruB/WzJmSlntau/Dzlp164Ok 0uiHIAFzSOzihfg8fKjmPXDSuNxBtm7rzCIQVN93KHROPH8L86yXcv585u68Sm4BcUtr TetxFrwsCUWUG1bPkmDxwrvRFsy9sT+LNxOpKmTztw2Y9BzcKTqxXHI6fWBY5R6Rr5xo 6DhFoziN50jVI45TwqdNbI22lC3C4lnAz2liDX3mo8URGiMpEESmEeRoFp5TztP4tiI5 zdRmgo0c4JrIHNVIWRk6GJMaNBR+gMhzOfoE2RZNfaYxzwqEf9bubuyORPCO/LOxG0Yw Loeg== MIME-Version: 1.0 X-Received: by 10.182.29.166 with SMTP id l6mr29459500obh.2.1401157100753; Mon, 26 May 2014 19:18:20 -0700 (PDT) Received: by 10.76.23.130 with HTTP; Mon, 26 May 2014 19:18:20 -0700 (PDT) Date: Mon, 26 May 2014 22:18:20 -0400 Message-ID: Subject: SR-IOV Patch Series 6/7: iovctl Configuration Tool From: Ryan Stone To: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2014 02:18:21 -0000 This patch series has the complete implementation of iovctl(8). This tool parses configuration files (in libucl format, the same format used by pkg(8)), converts the configuration to the nvlist-based format used in the kernel, validates the configuration, and then passes the configuration to the kernel. Validating the configuration in iovctl is technically redundant however iovctl is much more able to give meaningful error messages to the administrator. http://people.freebsd.org/~rstone/patches/iov/0016-Add-iovctl-functions-for-validating-config.patch [PATCH 16/21] Add iovctl functions for validating config Add an function to iovctl that validates the configuration against a schema. This function is able to assume that the parser has done most of the validation already and it's only responsible for applying default VF values specified in the config file, confirming that all required parameters have been set and that no invalid VF numbers have been specified. --- usr.sbin/iovctl/validate.c | 274 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) http://people.freebsd.org/~rstone/patches/iov/0017-Add-functions-for-parsing-the-iovctl-config-file.patch [PATCH 17/21] Add functions for parsing the iovctl config file Add two functions for parsing the iovctl config file. The config file is parsed using libucl[1], which accepts most YAML files and a superset of JSON. The first function is an ad-hoc parser that searches the file for the PF.DEVICE configuration value. We need to know that value in order to fetch the schema from the kernel, and we need the schema in order to be able to fully parse the file. The second function parses the config file and validates it against a schema. This function will exit with an error message if any validation error occurs. If it succeeds, the configuration is returned as an nvlist suitable for passing to the kernel. [1] https://github.com/vstakhov/libucl --- usr.sbin/iovctl/parse.c | 398 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 398 insertions(+) http://people.freebsd.org/~rstone/patches/iov/0018-Add-main-for-iovctl-and-hook-iovctl-into-build.patch [PATCH 18/21] Add main() for iovctl and hook iovctl into build --- usr.sbin/Makefile | 1 + usr.sbin/iovctl/Makefile | 19 +++ usr.sbin/iovctl/iovctl.c | 402 +++++++++++++++++++++++++++++++++++++++++++++++ usr.sbin/iovctl/iovctl.h | 37 +++++ 4 files changed, 459 insertions(+)