Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2716564img; Sun, 24 Mar 2019 17:03:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPzgBcmVd57Cd8eWZoBhkOk8RCFY9Abfq+xtVXdDl9wO99lBk/xYH+Gxc+auCfwHvhMGfj X-Received: by 2002:a17:902:6b05:: with SMTP id o5mr22058770plk.90.1553472231573; Sun, 24 Mar 2019 17:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553472231; cv=none; d=google.com; s=arc-20160816; b=y0l8qykCo+PKVIwbhyzEhP16f1PNWFqPjXUc+tyQVzgEWKSuMJy/OtnhBeeCyFkkMa Bu7hHVlk0SZgRU5h3vVjqPeKeWD7VwS7MaVZDMbJUxdYSr0NQQB+jHCU/YGjVanmZTEB jG9hAst/pXTxl7H8dUXWQ0ARoXj3Grq2aQiM0ir5D4i1+5688c+UsAww8vwpSfLTg6xM etS2UiOwoxfVA4QxFHDgmHolyIHfEYtNZ4AYBukSjmWTgMEGW3Wy8Mh6RjqrHYwcUwG8 Nw+QisaKMtEI2FbcAl9UTa3XXyeyOBcV4jmpi7jx+xr73qL4+tSad+YJ4JIgndK9Ncb7 WIdw== 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:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=50KHmzqql6UexFEYfbeuA5oUnlB0V0uDI/+PlWvJZIY=; b=DSJT19HjV9Q9goIiIh7/yf9cx1+w6uvLq7vwu6xTeUn9pGFUWdDGe4U3CJyUPrs0xV eqRpOih0GbYI+trF0sHMGlBpvBGg7l3pl/I2JELTijkW18mVROT8amshuZTux1+mC8Pk yby5okrJQdPE2Xyim9N/Bm8qnS5XRE5AmTRivn3VzmMNOF0295DVavOTIlXzbyl/+l6l xv3iGc+Djc+5nrRu5TqyTFLob1Ar0XcRugW2FpHW+uNiFCsypmaKh5TqLIBy3AeMwPCk IruWrQkR5fmeSAr4EbJ+IgZRXBF6mKUak5XS4L/j7cy6/m5J+whsG1YoNGkKch8wKCki EEtg== ARC-Authentication-Results: i=1; mx.google.com; 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 h21si12693789plr.229.2019.03.24.17.03.35; Sun, 24 Mar 2019 17:03:51 -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; 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 S1729170AbfCYAC6 (ORCPT + 99 others); Sun, 24 Mar 2019 20:02:58 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:44492 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727275AbfCYAC5 (ORCPT ); Sun, 24 Mar 2019 20:02:57 -0400 Received: from localhost (unknown [50.233.106.125]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 0C83812DE5812; Sun, 24 Mar 2019 17:02:57 -0700 (PDT) Date: Sun, 24 Mar 2019 20:02:54 -0400 (EDT) Message-Id: <20190324.200254.1946143057733371048.davem@davemloft.net> To: Jason@zx2c4.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, gregkh@linuxfoundation.org Subject: Re: [PATCH net-next v9 19/19] net: WireGuard secure network tunnel From: David Miller In-Reply-To: <20190322071122.6677-20-Jason@zx2c4.com> References: <20190322071122.6677-1-Jason@zx2c4.com> <20190322071122.6677-20-Jason@zx2c4.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 24 Mar 2019 17:02:57 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Jason A. Donenfeld" Date: Fri, 22 Mar 2019 01:11:22 -0600 > +static __always_inline void swap_endian(u8 *dst, const u8 *src, u8 bits) > +{ Unless you have an absolutely requirement on inlining (if uninlined, the compilation would break), you must not use the __always_inline keyword and you must let the compiler decide what to do. Said another way: "The code isn't optimal with my compiler on my computer unless I force inline this" is not a valid reason to use __always_inline And for this reason we never use __inline in foo.c files, always let the compiler decide. This applies to your entire submission. > + ((u64 *)dst)[0] = be64_to_cpu(((const __be64 *)src)[0]); > + ((u64 *)dst)[1] = be64_to_cpu(((const __be64 *)src)[1]); Are 'dst' and 'src' both 64-bit aligned? If not you'll get traps on some cpus. > + __skb_queue_head_init(&packets); > + if (!skb_is_gso(skb)) { > + skb->next = NULL; Why? Direct ->next and ->prev pointer accesses should never be used, along with anything that assumes what the implentation of skb lists looks like. Always use the helpers instead. > diff --git a/drivers/net/wireguard/hashtables.c b/drivers/net/wireguard/hashtables.c > new file mode 100644 > index 000000000000..8aedc17b85f9 > --- /dev/null > +++ b/drivers/net/wireguard/hashtables.c No way. Do not invent your own hashtables, we have several generic versions in tree and in particular rhashtable. If the generic kernel facilities have a weakness, fix that instead of rolling an entire new hashtable implementation.