From: David Miller <davem@davemloft.net>
To: decui@microsoft.com
Cc: jhansen@vmware.com, stefanha@redhat.com, netdev@vger.kernel.org,
mkubecek@suse.cz, joe@perches.com, olaf@aepfle.de,
sthemmin@microsoft.com, jasowang@redhat.com, kys@microsoft.com,
haiyangz@microsoft.com, dave.scott@docker.com,
linux-kernel@vger.kernel.org, apw@canonical.com,
rolf.neugebauer@docker.com, gregkh@linuxfoundation.org,
marcelo.cerri@canonical.com, devel@linuxdriverproject.org,
vkuznets@redhat.com, georgezhang@vmware.com,
dan.carpenter@oracle.com, acking@vmware.com, dtor@vmware.com,
grantr@vmware.com, cavery@redhat.com
Subject: Re: [PATCH v2 net-next 1/1] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)
Date: Thu, 24 Aug 2017 18:19:31 -0700 (PDT) [thread overview]
Message-ID: <20170824.181931.584865895464286033.davem@davemloft.net> (raw)
In-Reply-To: <KL1P15301MB0008D0FB2F8F5B90E7737C3CBF850@KL1P15301MB0008.APCP153.PROD.OUTLOOK.COM>
From: Dexuan Cui <decui@microsoft.com>
Date: Wed, 23 Aug 2017 04:52:14 +0000
> +#define VMBUS_PKT_TRAILER (sizeof(u64))
This is not the packet trailer, it's the size of the packet trailer.
Please make this macro name match more accurately what it is.
> + /* Have we sent the zero-length packet (FIN)? */
> + unsigned long fin_sent;
Why does this need to be atomic? Why can't a smaller simpler
mechanism be used to make sure hvs_shutdown() only performs
hvs_send_data() call once on the channel?
> +static inline bool is_valid_srv_id(const uuid_le *id)
> +{
> + return !memcmp(&id->b[4], &srv_id_template.b[4], sizeof(uuid_le) - 4);
> +}
Do not use the inline function attribute in *.c code. Let the
compiler decide.
> +static inline unsigned int get_port_by_srv_id(const uuid_le *svr_id)
Likewise.
> +static inline void hvs_addr_init(struct sockaddr_vm *addr,
Likewise.
> +static inline void hvs_remote_addr_init(struct sockaddr_vm *remote,
> + struct sockaddr_vm *local)
Likewise.
And so on and so forth, please audit this for your entire patch.
> + *((u32 *)&h->vm_srv_id) = vsk->local_addr.svm_port;
> + *((u32 *)&h->host_srv_id) = vsk->remote_addr.svm_port;
There has to be a better way to express this.
And if this is partially initializing vm_srv_id, at a minimum
endianness needs to be taken into account.
next prev parent reply other threads:[~2017-08-25 1:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 4:52 [PATCH v2 net-next 1/1] hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK) Dexuan Cui
2017-08-25 1:19 ` David Miller [this message]
2017-08-25 3:19 ` Dexuan Cui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170824.181931.584865895464286033.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=acking@vmware.com \
--cc=apw@canonical.com \
--cc=cavery@redhat.com \
--cc=dan.carpenter@oracle.com \
--cc=dave.scott@docker.com \
--cc=decui@microsoft.com \
--cc=devel@linuxdriverproject.org \
--cc=dtor@vmware.com \
--cc=georgezhang@vmware.com \
--cc=grantr@vmware.com \
--cc=gregkh@linuxfoundation.org \
--cc=haiyangz@microsoft.com \
--cc=jasowang@redhat.com \
--cc=jhansen@vmware.com \
--cc=joe@perches.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.cerri@canonical.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=rolf.neugebauer@docker.com \
--cc=stefanha@redhat.com \
--cc=sthemmin@microsoft.com \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox