[PATCH] Receive multiple packets at a time

Guus Sliepen guus at tinc-vpn.org
Thu Dec 10 09:10:07 CET 2015


On Thu, Dec 10, 2015 at 09:34:45AM +0300, Michael Tokarev wrote:

> > 10.12.2015 03:35, Samuel Thibault wrote:
> > Here it is.

Thanks!

> 10.12.2015 09:20, Michael Tokarev wrote:
> > 
> > I suggest reducing ifdeffery in handle_incoming_vpn_data(), especially
> > the error checking code.

That does seem to make it even more readable. I can merge both your
changes :)

> Also, this is interesting.  We should either reduce MAX_MSG to, say, 64,
> or even 16, and/or initialize this array statically (except of iov.iov_len).

Reducing MAX_MSG might make sense. I think some real-world testing
should tell us how many packets are queued on average under high load,
and size the arrays accordingly.

As for static initialization, I don't see that being helpful. It would
be much more verbose to write out the initialization of a whole array,
and the compiler would generate more or less identical code to the
for-loop in Samuel's patch. The only improvement I can think of is this:

for(i = 0; i < MAX_MSG; i++) {
	iov[i] = (struct iovec){
		.iov_base = &pkt[i].seqno;
		.iov_len = MAXSIZE;
	};
	msg[i].msg_hdr = (struct msg_hdr){
		.msg_name = &from[i].sa,
		.msg_namelen = sizeof from[i],
		.msg_iov = &iov[i],
		msg_iovlen = 1,
	};
}

Or am I missing something?

-- 
Met vriendelijke groet / with kind regards,
     Guus Sliepen <guus at tinc-vpn.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.tinc-vpn.org/pipermail/tinc-devel/attachments/20151210/4f9c0fc5/attachment.sig>


More information about the tinc-devel mailing list