Received: by 10.192.165.148 with SMTP id m20csp38797imm; Thu, 26 Apr 2018 15:31:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MgVhWU3o8UEO/b5HP53HBJgM8Y/JxET+Y4KKVjIychafAsryIrCb+G6B2icfwEsDvgah8 X-Received: by 10.98.190.2 with SMTP id l2mr34133262pff.224.1524781881276; Thu, 26 Apr 2018 15:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524781881; cv=none; d=google.com; s=arc-20160816; b=wep2LpThoWvuPFpu8NJqK4oZupPRhQMtuFX74Dhs2UrqqEkFR/q4yr0jQ++mZ1EwqP 1LqRpjKapgRItuSAtCJBxlRVBaCpv8Tcyc+95icfY1ObXcw0z3vgIFpq6rxFdUG1aCDG bcwl8yV7J28OQR1sDISS/k0S/b+vks9c2wWpg/c5sZ+FDHAW4bN/QPNC1a5UdKD8mA8m u9x9agXQUBS1QT6mQMxmVKqotzofdz8PaTQ8evkGMpLEK5c8lKz9LcvCrsFqWGQBETu2 xgpYsRoNbUAxLegXIezpkQi/g7Ge6E53bX3rbXMuaDrMcn6AgxUvhM0aYepFNEpL7c6X sZsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=IvQxaL85qQbkgTASDKwKnhU6SA+E7ei/OR1nFyjs3CQ=; b=tZoPDTAGyBxGZSqK6HBCDUoERlZuqFit6qIPlxpquzsMGAgzdBrw5fPxc3zjvAvVAI tWAUD+cmgfpQBz16zU2IAf3lgMamv0Wf9Quqmuqep1iSXOYP2OsRWPF+3b3p/rD5LrEs n6YaJpVKqFfVWZdtjTM152zPYJ98gteUI8P+uDfnqiyCDp6fBeP8wyAZyp4AAuwdacEd x297wo6sPLjUz9ikFchjXQ6RM2CBwj7Ck3ispaPUunj4Z8cyeZ6NObwy4teCnZN46noo UGi1b+bytzKKgsthQ9FsIG9OHhGdapKD/udxzTEzsMevHNfYGSfzMp6yNSePh3Ayx9y3 uY8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=XJF7XBZi; dkim=pass header.i=@codeaurora.org header.s=default header.b=XJF7XBZi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 189si13845730pgi.254.2018.04.26.15.31.05; Thu, 26 Apr 2018 15:31:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=XJF7XBZi; dkim=pass header.i=@codeaurora.org header.s=default header.b=XJF7XBZi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756418AbeDZW35 (ORCPT + 99 others); Thu, 26 Apr 2018 18:29:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43966 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754348AbeDZW3z (ORCPT ); Thu, 26 Apr 2018 18:29:55 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C682260AE0; Thu, 26 Apr 2018 22:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524781794; bh=lKugr7dXGCgvdMPfOe11o+tbB9ZoiExHNpAi1wpiciA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=XJF7XBZiZeSmchuF/7paXqib8sZyZKiDzXYfoelFSPjxeVl9TAE13DcMchQum2p6F /xPK4W+lo0E1MgVLBTdBdKjQlcfTl3JsK8ElK8qDti5eLr0/ByqynbQDm65yxGgGPO QT+1ZsyJ8RQzar3z/Vw+Gp8YxOTDArEZOPOgBzBk= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.142.6] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: clew@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2003660390; Thu, 26 Apr 2018 22:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524781794; bh=lKugr7dXGCgvdMPfOe11o+tbB9ZoiExHNpAi1wpiciA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=XJF7XBZiZeSmchuF/7paXqib8sZyZKiDzXYfoelFSPjxeVl9TAE13DcMchQum2p6F /xPK4W+lo0E1MgVLBTdBdKjQlcfTl3JsK8ElK8qDti5eLr0/ByqynbQDm65yxGgGPO QT+1ZsyJ8RQzar3z/Vw+Gp8YxOTDArEZOPOgBzBk= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2003660390 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=clew@codeaurora.org Subject: Re: [PATCH v2] net: qrtr: Expose tunneling endpoint to user space To: Bjorn Andersson , "David S. Miller" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20180423214653.10016-1-bjorn.andersson@linaro.org> From: Chris Lew Message-ID: <46fe45d8-6f3a-5bed-c02c-6e61ba1175d2@codeaurora.org> Date: Thu, 26 Apr 2018 15:29:53 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180423214653.10016-1-bjorn.andersson@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/23/2018 2:46 PM, Bjorn Andersson wrote: > This implements a misc character device named "qrtr-tun" for the purpose > of allowing user space applications to implement endpoints in the qrtr > network. > > This allows more advanced (and dynamic) testing of the qrtr code as well > as opens up the ability of tunneling qrtr over a network or USB link. > > Signed-off-by: Bjorn Andersson Acked-by: Chris Lew > +static ssize_t qrtr_tun_read_iter(struct kiocb *iocb, struct iov_iter *to) > +{ > + struct file *filp = iocb->ki_filp; > + struct qrtr_tun *tun = filp->private_data; > + struct sk_buff *skb; > + int count; > + > + while (!(skb = skb_dequeue(&tun->queue))) { > + if (filp->f_flags & O_NONBLOCK) > + return -EAGAIN; > + > + /* Wait until we get data or the endpoint goes away */ > + if (wait_event_interruptible(tun->readq, > + !skb_queue_empty(&tun->queue))) > + return -ERESTARTSYS; > + } > + > + count = min_t(size_t, iov_iter_count(to), skb->len); > + if (copy_to_iter(skb->data, count, to) != count) > + count = -EFAULT; > + > + kfree_skb(skb); Is it better to use consume_skb() since this is the expected behavior path? > + > + return count; > +} > + Thanks, Chris -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project