From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754776AbcGEIWE (ORCPT ); Tue, 5 Jul 2016 04:22:04 -0400 Received: from smtprelay0220.hostedemail.com ([216.40.44.220]:35112 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752176AbcGEIV7 (ORCPT ); Tue, 5 Jul 2016 04:21:59 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::,RULES_HIT:16:41:355:379:541:599:973:988:989:1042:1260:1277:1311:1313:1314:1345:1359:1373:1437:1500:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:2393:2538:2539:2553:2559:2562:2734:2828:2904:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:5007:6119:6737:7688:7809:7882:9010:9149:10004:10400:10450:10455:10848:11026:11232:11658:11783:11914:12043:12048:12296:12517:12519:12740:13161:13229:13439:13894:14345:14347:14659:14721:19904:19999:21067:21080:21433:30012:30029:30054:30056:30067:30070:30083:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: tub98_85554412c6c2e X-Filterd-Recvd-Size: 4860 Message-ID: <1467706914.19760.16.camel@perches.com> Subject: Re: [PATCH v14 net-next 1/1] hv_sock: introduce Hyper-V Sockets From: Joe Perches To: Dexuan Cui , "davem@davemloft.net" , "gregkh@linuxfoundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , "jasowang@redhat.com" , Vitaly Kuznetsov , Cathy Avery , KY Srinivasan Cc: Haiyang Zhang , Rolf Neugebauer Date: Tue, 05 Jul 2016 01:21:54 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2016-06-30 at 15:58 +0000, Dexuan Cui wrote: > Hyper-V Sockets (hv_sock) supplies a byte-stream based communication > mechanism between the host and the guest. It's somewhat like TCP over > VMBus, but the transportation layer (VMBus) is much simpler than IP. trivia: > diff --git a/include/net/af_hvsock.h b/include/net/af_hvsock.h [] > @@ -0,0 +1,59 @@ [] > +#define sk_to_hvsock(__sk)   ((struct hvsock_sock *)(__sk)) > +#define hvsock_to_sk(__hvsk) ((struct sock *)(__hvsk)) Might as well be static inlines > +/* We send at most 4KB payload per VMBus packet. */ > +struct hvsock_send_buf { > + struct vmpipe_proto_header hdr; > + u8 buf[PAGE_SIZE]; PAGE_SIZE might not be the right define here if the comment is to be believed. > diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h [] > @@ -396,4 +397,27 @@ struct hv_kvp_ip_msg { >   struct hv_kvp_ipaddr_value      kvp_ip_val; >  } __attribute__((packed)); >   > +/* This is the address fromat of Hyper-V Sockets. format > diff --git a/net/hv_sock/af_hvsock.c b/net/hv_sock/af_hvsock.c [] > @@ -0,0 +1,1519 @@ > +/* > + * Hyper-V Sockets -- a socket-based communication channel between the > + * Hyper-V host and the virtual machines running on it. > + * > + * Copyright(c) 2016, Microsoft Corporation. All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * > + * 1. Redistributions of source code must retain the above copyright > + *    notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + *    notice, this list of conditions and the following disclaimer in the > + *    documentation and/or other materials provided with the distribution. > + * 3. The name of the author may not be used to endorse or promote > + *    products derived from this software without specific prior written > + *    permission. > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED > + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, > + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES > + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR > + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, > + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING > + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > + * POSSIBILITY OF SUCH DAMAGE. > + */ Is this license GPL compatible? > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > +#include > +#include > +#include > +#include > + > +static struct proto hvsock_proto = { > + .name = "HV_SOCK", > + .owner = THIS_MODULE, > + .obj_size = sizeof(struct hvsock_sock), > +}; const? > +static int hvsock_recvmsg_wait(struct sock *sk, struct msghdr *msg, > +        size_t len, int flags) > +{ [] > + if (ret != 0 || payload_len > > + sizeof(hvsk->recv->buf)) { This could look nicer as if (ret != 0 ||     payload_len > sizeof(hvsk->recv->buf)) {