From patchwork Mon Feb 21 14:11:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 12753663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62D57C4332F for ; Mon, 21 Feb 2022 14:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354822AbiBUOMU (ORCPT ); Mon, 21 Feb 2022 09:12:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357838AbiBUOMS (ORCPT ); Mon, 21 Feb 2022 09:12:18 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D0D1EACF for ; Mon, 21 Feb 2022 06:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=cUKjrvLXXGPTEBL7mXtgRrtbMDTqdYHoiDfga5F+Dkw=; t=1645452713; x=1646662313; b=sVAtfM5+G8sHVqBxjsv4VdEissntsQsiR87uyKlcswVPKivGIO50NlS+NfTp6MeknsEzqrtOFin 37cQVPFCs7YnzePmt8Jlo7q273Ifv0J2AUwyQzXEsEL/0DbJHO5jPlD0mw2dVKNWrpCvu+PTIHEjZ 3mN86Bg4IG8n9V7YvrA38FC3GtwU1DJ4RdQGt7aLhylCTxXg0lIUGe7VBjHxHAttBRrQfUL4uTuvW 036fehbr/SbPQqeYdnK16A9FFpG8g3SPcGUjQZqMakABS2sbceYGHyyTtdLBFJQiC9clUNqiz8VPH zNdz+hLd0xe1xIf/fXUUaU9jbFK6TCwRZZZw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nM9Pp-003r4r-UY; Mon, 21 Feb 2022 15:11:50 +0100 From: Johannes Berg To: backports@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 1/3] backports: stub structs but remove ndo_fill_forward_path Date: Mon, 21 Feb 2022 15:11:45 +0100 Message-Id: <20220221151147.f0ab663b932a.I59271805ee60501a03c50f5ec05240393f1fb4be@changeid> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org From: Johannes Berg Signed-off-by: Johannes Berg --- backport/backport-include/linux/netdevice.h | 55 +++++++++++++++++++++ patches/0107-net-forward-path.cocci | 19 +++++++ 2 files changed, 74 insertions(+) create mode 100644 patches/0107-net-forward-path.cocci diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h index 2ef89e04c1a9..6214a69a3e65 100644 --- a/backport/backport-include/linux/netdevice.h +++ b/backport/backport-include/linux/netdevice.h @@ -192,4 +192,59 @@ static inline void backport_dev_hold(struct net_device *dev) #define dev_hold LINUX_BACKPORT(dev_hold) #endif /* < 5.15 */ +#ifndef NET_DEVICE_PATH_STACK_MAX +enum net_device_path_type { + DEV_PATH_ETHERNET = 0, + DEV_PATH_VLAN, + DEV_PATH_BRIDGE, + DEV_PATH_PPPOE, + DEV_PATH_DSA, +}; + +struct net_device_path { + enum net_device_path_type type; + const struct net_device *dev; + union { + struct { + u16 id; + __be16 proto; + u8 h_dest[ETH_ALEN]; + } encap; + struct { + enum { + DEV_PATH_BR_VLAN_KEEP, + DEV_PATH_BR_VLAN_TAG, + DEV_PATH_BR_VLAN_UNTAG, + DEV_PATH_BR_VLAN_UNTAG_HW, + } vlan_mode; + u16 vlan_id; + __be16 vlan_proto; + } bridge; + struct { + int port; + u16 proto; + } dsa; + }; +}; + +#define NET_DEVICE_PATH_STACK_MAX 5 +#define NET_DEVICE_PATH_VLAN_MAX 2 + +struct net_device_path_stack { + int num_paths; + struct net_device_path path[NET_DEVICE_PATH_STACK_MAX]; +}; + +struct net_device_path_ctx { + const struct net_device *dev; + const u8 *daddr; + + int num_vlans; + struct { + u16 id; + __be16 proto; + } vlan[NET_DEVICE_PATH_VLAN_MAX]; +}; +#endif /* NET_DEVICE_PATH_STACK_MAX */ + #endif /* __BACKPORT_NETDEVICE_H */ diff --git a/patches/0107-net-forward-path.cocci b/patches/0107-net-forward-path.cocci new file mode 100644 index 000000000000..f612239404a6 --- /dev/null +++ b/patches/0107-net-forward-path.cocci @@ -0,0 +1,19 @@ +@ops@ +identifier ops, fn; +@@ +const struct net_device_ops ops = { ++#if LINUX_VERSION_IS_GEQ(5,13,0) + .ndo_fill_forward_path = fn, ++#endif + ... +}; + +@@ +identifier ops.fn; +@@ ++#if LINUX_VERSION_IS_GEQ(5,13,0) +int fn(...) +{ +... +} ++#endif /* LINUX_VERSION_IS_GEQ(5,13,0) */ From patchwork Mon Feb 21 14:11:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 12753664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA4C6C433EF for ; Mon, 21 Feb 2022 14:11:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240412AbiBUOMT (ORCPT ); Mon, 21 Feb 2022 09:12:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354822AbiBUOMQ (ORCPT ); Mon, 21 Feb 2022 09:12:16 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079BE1EACE for ; Mon, 21 Feb 2022 06:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=hloev+emqP0hev3mO1C+xMNfS5DHp35/7ftJb7wY7Gs=; t=1645452713; x=1646662313; b=r8rmkHwF89/vGSzACbF3sdTyLfiWFiYGLSerUnALOnETB4J +hq2czNSHysFbhFCW1qhPOzzytjg8U4g4lo+KUmYLTU8W2fUhkGSnL8TBUzOHoOkuVCiewDfE4++Y qLemW8kAW0EJEnK4uekA9K9tFai+bvGyK4AsMy43gSjxFHM7uVTZ3rSJnsfHLYghhQ77K+5rzvZco c/Q4xEJyoFcBY5jRsTxo82bqrPd42Cd9QLDCAQGuFrL3lrA5PgG3AgWaDSlpL7PIoz+qxG61TSk2G aaQXdpedFOVSZ36C5YkifXa+D8N7Vpl0tqQXMzaQLYihBWpiBIzmBXlKiISvX7Hg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nM9Pq-003r4r-Cy; Mon, 21 Feb 2022 15:11:50 +0100 From: Johannes Berg To: backports@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 2/3] backports: add memset_after/memset_startat Date: Mon, 21 Feb 2022 15:11:46 +0100 Message-Id: <20220221151147.a5b2af9ae6e4.I22eae0fdc7b78cf10a7dee6fe477fbf0c9a5e807@changeid> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221151147.f0ab663b932a.I59271805ee60501a03c50f5ec05240393f1fb4be@changeid> References: <20220221151147.f0ab663b932a.I59271805ee60501a03c50f5ec05240393f1fb4be@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org From: Johannes Berg Signed-off-by: Johannes Berg --- backport/backport-include/linux/string.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/backport/backport-include/linux/string.h b/backport/backport-include/linux/string.h index 39257e5f66ab..dc29dcf72b24 100644 --- a/backport/backport-include/linux/string.h +++ b/backport/backport-include/linux/string.h @@ -12,4 +12,24 @@ extern void *memdup_user_nul(const void __user *, size_t); int match_string(const char * const *array, size_t n, const char *string); #endif /* LINUX_VERSION_IS_LESS(4,5,0) */ +#ifndef memset_after +#define memset_after(obj, v, member) \ +({ \ + u8 *__ptr = (u8 *)(obj); \ + typeof(v) __val = (v); \ + memset(__ptr + offsetofend(typeof(*(obj)), member), __val, \ + sizeof(*(obj)) - offsetofend(typeof(*(obj)), member)); \ +}) +#endif + +#ifndef memset_startat +#define memset_startat(obj, v, member) \ +({ \ + u8 *__ptr = (u8 *)(obj); \ + typeof(v) __val = (v); \ + memset(__ptr + offsetof(typeof(*(obj)), member), __val, \ + sizeof(*(obj)) - offsetof(typeof(*(obj)), member)); \ +}) +#endif + #endif /* __BACKPORT_LINUX_STRING_H */ From patchwork Mon Feb 21 14:11:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 12753665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F2D4C433FE for ; Mon, 21 Feb 2022 14:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357838AbiBUOMV (ORCPT ); Mon, 21 Feb 2022 09:12:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377336AbiBUOMS (ORCPT ); Mon, 21 Feb 2022 09:12:18 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0DCC1EAD2 for ; Mon, 21 Feb 2022 06:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=WjbUeLb7BSeI9OfRwZeFvuwMCGt3q3GTV0+XAm3tQQY=; t=1645452713; x=1646662313; b=HCNaAKT/n7c7JF7dY6ZjAXNaRAmkgLIH/6p3sQlz4pX5+Ol Wt6EkNCRS+539zFZ/mDsJYZVrrW998z9EUIK7yru3yF49SLAQH58/7Li75ROHjf+P7kCJjM4XuZmv dvh9ml5f1GU9C18JOwTCvYdi/wqTHqEZM6e0Rgt7KRGVtWWmuic4tzWGZnN+XpuZ2zQ58E6Io1hgb l5sN1SiBKiaC+A6+Zhej+HChlZ1QUC6yKsfg86KQUyYVcEmxDtiXMeZGPlyru8hZJf4tTsa9k8Q/H UA0PQyvMyzrTJ2e14mr72b55ncBPq+3jat/0nKdYBSYk2TVhIoBH0zqpMO/Q74Dw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) (envelope-from ) id 1nM9Pq-003r4r-LQ; Mon, 21 Feb 2022 15:11:50 +0100 From: Johannes Berg To: backports@vger.kernel.org Cc: Johannes Berg Subject: [PATCH 3/3] backports: add ktime_get_coarse_boottime_ns Date: Mon, 21 Feb 2022 15:11:47 +0100 Message-Id: <20220221151147.3fccada91a71.Id1c6b53e4c57d92eb838e4c09ef8042cd42f150f@changeid> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221151147.f0ab663b932a.I59271805ee60501a03c50f5ec05240393f1fb4be@changeid> References: <20220221151147.f0ab663b932a.I59271805ee60501a03c50f5ec05240393f1fb4be@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org From: Johannes Berg ... and simplify the code while at it. Signed-off-by: Johannes Berg --- backport/backport-include/linux/timekeeping.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h index 80c625569d6e..87744572bce6 100644 --- a/backport/backport-include/linux/timekeeping.h +++ b/backport/backport-include/linux/timekeeping.h @@ -6,23 +6,18 @@ #include_next #if LINUX_VERSION_IS_LESS(5,3,0) -#define ktime_get_boottime_ns LINUX_BACKPORT(ktime_get_boottime_ns) -static inline u64 ktime_get_boottime_ns(void) -{ - return ktime_get_boot_ns(); -} +#define ktime_get_boottime_ns ktime_get_boot_ns +#define ktime_get_coarse_boottime_ns ktime_get_boot_ns #endif /* < 5.3 */ #if LINUX_VERSION_IS_LESS(4,18,0) extern time64_t ktime_get_boottime_seconds(void); -#endif /* < 4.18 */ -#if LINUX_VERSION_IS_LESS(4,18,0) #define ktime_get_raw_ts64 LINUX_BACKPORT(ktime_get_raw_ts64) static inline void ktime_get_raw_ts64(struct timespec64 *ts) { return getrawmonotonic64(ts); } -#endif +#endif /* < 4.18 */ #endif /* __BACKPORT_TIMEKEEPING_H */