Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp409815pxa; Thu, 27 Aug 2020 05:59:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfz8UhH0Y/JVmLW4ztWzWqLQQzpoNU/iZwgyBBkvhzHUlXalMVqkm3ZdlhyEVzXT9EZ9Xd X-Received: by 2002:a17:906:4a99:: with SMTP id x25mr21638971eju.439.1598533154887; Thu, 27 Aug 2020 05:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598533154; cv=none; d=google.com; s=arc-20160816; b=uB8PnSeu1VjEJADT7gNrPi48RDaWTlciqHE3AsDaNvUWP9Ltk5qTBQ2IZJ/vdrdRpX TzHmU0RmfOWiOfF/CHZtdMZV3OXXnnS1moZjwGr940JCNu5Q6q0+JjeF4ZzQO1ehiIHr 4yOT/vCN0l3Nu7qAB5MH+JCYCGbZ+4raId2HErxVNXCMXUb0tQ4RHar29TfJUa6OMQYe CL/EfIw20KxM6h75IjUL7nh8SYux1Oo5KskERUsLoasLSWlJ+JnCgU7aKbd6003oTvk3 p8EOdaohijq3rqpBpVDGvBYyS5jGXFb99fdxRKUecBMXei35WI6kjHUO717vjaUFGcw8 geDA== 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 :user-agent:references:in-reply-to:date:to:from:subject:message-id; bh=Q7M+o/iXW4cr2cVsfS4YWX+e6xvd9N0G8SYP06Yub1c=; b=uO/MmJFULDYaZN7GN3Pl+lvmM7sGUvPy2T0KMQ/QOaSq6yEDIRtrgErRVX/nngz+jH dAL+HMQbplHEVa59aMmj+2rCpjs5EmxrUIXrk5TxBavPOZJNTkswQEvaYLKN7hgpqCWj yDN3neGLmAAm1iKcK92UCUjJVTrINv+MGfL78nupyoykZrqhcILyZ4fz7NBtLVaQnf1l MgWY1cxGr+6Wzy+WPzPAYjY4sOR82Kjk5cfDmo7ybU4z4GMGlhr3KhFQ49ksrGn5JSwg zmDfG17h27V3H6hLBtyOCrbt51FIklSdk1yMn9isEEr7Xxx4aHghfDjeGjbeXFNR1Rn4 0Hpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g14si1310692ejr.420.2020.08.27.05.58.50; Thu, 27 Aug 2020 05:59:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726838AbgH0M6Q (ORCPT + 99 others); Thu, 27 Aug 2020 08:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728981AbgH0MmP (ORCPT ); Thu, 27 Aug 2020 08:42:15 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F11A1C061264 for ; Thu, 27 Aug 2020 05:42:11 -0700 (PDT) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kBHEH-00Bais-FO; Thu, 27 Aug 2020 14:42:09 +0200 Message-ID: Subject: Re: [PATCH v3 01/13] mac80211: rework tx encapsulation offload API From: Johannes Berg To: Felix Fietkau , linux-wireless@vger.kernel.org Date: Thu, 27 Aug 2020 14:42:07 +0200 In-Reply-To: <20200821084926.10650-2-nbd@nbd.name> References: <20200821084926.10650-1-nbd@nbd.name> <20200821084926.10650-2-nbd@nbd.name> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org I was going to not worry about it, but now that I'm replying anyway ... > +++ b/net/mac80211/iface.c > @@ -43,6 +43,7 @@ > */ > > static void ieee80211_iface_work(struct work_struct *work); > +static void ieee80211_set_vif_encap_ops(struct ieee80211_sub_if_data *sdata); Do we really need that, can can't reorder things? > +static bool ieee80211_iftype_supports_encap_offload(enum nl80211_iftype iftype) > +{ > + switch (iftype) { > + case NL80211_IFTYPE_AP: > + case NL80211_IFTYPE_P2P_GO: > + case NL80211_IFTYPE_P2P_CLIENT: The P2P ones cannot happen here due to the iftype munging that mac80211 does, suggest you add a comment about that and remove them. > + list_for_each_entry(key, &sdata->key_list, list) { > + if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC || > + key->conf.cipher == WLAN_CIPHER_SUITE_BIP_GMAC_128 || > + key->conf.cipher == WLAN_CIPHER_SUITE_BIP_GMAC_256 || > + key->conf.cipher == WLAN_CIPHER_SUITE_BIP_CMAC_256) > + continue; I had to read that a few times to understand it ... maybe add a comment that the management frame keys aren't relevant? :) But anyway, what I was really not sure about is this function: > +static void ieee80211_set_vif_encap_ops(struct ieee80211_sub_if_data *sdata) > +{ > + struct ieee80211_local *local = sdata->local; > + struct ieee80211_sub_if_data *bss = sdata; > + struct ieee80211_key *key; > + bool enabled; > + > + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { > + if (!sdata->bss) > + return; > + > + bss = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap); > + } > + > + if (!ieee80211_hw_check(&local->hw, SUPPORTS_TX_ENCAP_OFFLOAD) || > + !ieee80211_iftype_supports_encap_offload(bss->vif.type)) > + return; There are a lot of returns here, some of which make sense, but the sdata->bss one seems dynamic and doesn't really make sense? Could it change? Or maybe we don't care because if it's not linked to a BSS it cannot be transmitting? johannes