Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp22856imm; Tue, 31 Jul 2018 13:04:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdtyuvh13cZIubm9y5c5Vh0qAWYAgX2YpnKoc2MrHslf9pSa/ub/Ezl5j8JJbImi6mJPdTz X-Received: by 2002:a65:5641:: with SMTP id m1-v6mr22385748pgs.246.1533067482308; Tue, 31 Jul 2018 13:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533067482; cv=none; d=google.com; s=arc-20160816; b=ib6jeRr81zL1JZHvUlL5i6sf8yfuSSUoiabbQfpsWr0d9E8ja7USKJucZFr1iTsb/c LVAqAOGZKGgxkj/rGYpi1bj/Cfwo67ozds4zeD+mj9oQHfA7AAhq2XbMDVlJkDPVL0Tr ZOtNqIalsTrFqUJ5OUaHYG0Q/rDH79BWsm7XEAExDRg17cH2hG93J6NtXDbfAoUc2Hcy Cqgw9FgsNavD+YrFW0vOXVXL7wKjTnUqdp4XbyX9OCmXIbxsLA6wN8UpTmdugOs0t/VW +AZkqc2yDKOlx+rRLR+EKl5PUq+mZSzy8f0Jtr8ETfBqLjAH+c3xkil6GuBDiO73/scl NvCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=QC/I0CZi/6LkQTjc9+mu8tTeq8br6lXSkpa4j5DUQUI=; b=h2ik5yJXpN8MrIUKe2st/f4vg7wcrMp8pKXLS4dT++xljFeF/l3D7D/7c7e7iLebsF sycpSYTZybPthj7zj/uMebJv8z6wkKP/lpI11s314AQ8R+yWYRzxLY9B/GTfAPw5ISqs IqNwxivEjKcLoGaqoiGacwoC6GR1efGnAhYQ9IQxHum2fpDS+F24zhuWun43TKwJUtBO 8bVnjVRO1OjL9iCREk2iS1SeYT6OsJBINyLVKO7Vb1Rqz/3sqNo13ukl+CaHLDVjAuZO tt+NfynBwkK/frY2vV5t8oFShd8z+A5NwPPKTglSBct1Cewp6Dzdz5a9ouU7p3XYaqIU 0njA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=GDhcsxF8; 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 o189-v6si14098306pga.577.2018.07.31.13.04.22; Tue, 31 Jul 2018 13:04:42 -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=@lunn.ch header.s=20171124 header.b=GDhcsxF8; 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 S1732610AbeGaVoW (ORCPT + 99 others); Tue, 31 Jul 2018 17:44:22 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:51977 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729924AbeGaVoW (ORCPT ); Tue, 31 Jul 2018 17:44:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=QC/I0CZi/6LkQTjc9+mu8tTeq8br6lXSkpa4j5DUQUI=; b=GDhcsxF83I/zRdgeg9Ux8jTLAby7447RAzt7oNBEZL0iSgHAVC2VeLsalcp/qunqBer1ffBSN6yU98DJBEKB6boO04mMLWlm5CzRawLnBlFYubnzc0PFO+hPyOH72wGuAxBllyE/u4ljdU/5Kc90l7EXMFuDCPt44Uf+/mJ+AZk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1fkaqd-0000OV-UB; Tue, 31 Jul 2018 22:02:23 +0200 Date: Tue, 31 Jul 2018 22:02:23 +0200 From: Andrew Lunn To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, davem@davemloft.net, Greg KH Subject: Re: [PATCH v1 3/3] net: WireGuard secure network tunnel Message-ID: <20180731200223.GA32125@lunn.ch> References: <20180731191102.2434-1-Jason@zx2c4.com> <20180731191102.2434-4-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180731191102.2434-4-Jason@zx2c4.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jason I just gave this patch to checkpatch.pl... total: 6 errors, 763 warnings, 6514 lines checked It would be good to reduce these numbers. > +static __always_inline void swap_endian(u8 *dst, const u8 *src, u8 bits) There is a general preference to not force the compile to inline. Leave it to decide. > +#define push(stack, p, len) ({ \ > + if (rcu_access_pointer(p)) { \ > + BUG_ON(len >= 128); \ > + stack[len++] = rcu_dereference_protected(p, lockdep_is_held(lock)); \ > + } \ > + true; \ > +}) > +#undef push > + > +#define push(p) ({ BUG_ON(len >= 128); stack[len++] = p; }) This is going to lead to bugs, coders thinking push() does one thing, when it actually does something else. I would suggest making these helper functions, with useful names. > +/* Returns a strong reference to a peer */ > +static __always_inline struct wireguard_peer *lookup(struct allowedips_node __rcu *root, u8 bits, const void *be_ip) > +{ > + struct wireguard_peer *peer = NULL; > + struct allowedips_node *node; > + u8 ip[16] __aligned(__alignof(u64)); netdev code requires that all local variables are in reverse christmas tree. Andrew