]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fix up some 5.10 bonding patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Feb 2026 14:23:58 +0000 (15:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Feb 2026 14:23:58 +0000 (15:23 +0100)
queue-5.10/bonding-add-a-vlan-srcmac-tx-hashing-option.patch [deleted file]
queue-5.10/bonding-provide-a-net-pointer-to-__skb_flow_dissect.patch
queue-5.10/net-bonding-refactor-bond_xmit_hash-for-use-with-xdp.patch [deleted file]
queue-5.10/net-bonding-take-ip-hash-logic-into-a-helper.patch [deleted file]
queue-5.10/series

diff --git a/queue-5.10/bonding-add-a-vlan-srcmac-tx-hashing-option.patch b/queue-5.10/bonding-add-a-vlan-srcmac-tx-hashing-option.patch
deleted file mode 100644 (file)
index c93d368..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
-From 99e16e20e3cd649a343cd64b81afa8a2cdcbb2d6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 18 Jan 2021 20:09:27 -0500
-Subject: bonding: add a vlan+srcmac tx hashing option
-
-From: Jarod Wilson <jarod@redhat.com>
-
-[ Upstream commit 7b8fc0103bb51d1d3e1fb5fd67958612e709f883 ]
-
-This comes from an end-user request, where they're running multiple VMs on
-hosts with bonded interfaces connected to some interest switch topologies,
-where 802.3ad isn't an option. They're currently running a proprietary
-solution that effectively achieves load-balancing of VMs and bandwidth
-utilization improvements with a similar form of transmission algorithm.
-
-Basically, each VM has it's own vlan, so it always sends its traffic out
-the same interface, unless that interface fails. Traffic gets split
-between the interfaces, maintaining a consistent path, with failover still
-available if an interface goes down.
-
-Unlike bond_eth_hash(), this hash function is using the full source MAC
-address instead of just the last byte, as there are so few components to
-the hash, and in the no-vlan case, we would be returning just the last
-byte of the source MAC as the hash value. It's entirely possible to have
-two NICs in a bond with the same last byte of their MAC, but not the same
-MAC, so this adjustment should guarantee distinct hashes in all cases.
-
-This has been rudimetarily tested to provide similar results to the
-proprietary solution it is aiming to replace. A patch for iproute2 is also
-posted, to properly support the new mode there as well.
-
-Cc: Jay Vosburgh <j.vosburgh@gmail.com>
-Cc: Veaceslav Falico <vfalico@gmail.com>
-Cc: Andy Gospodarek <andy@greyhouse.net>
-Cc: Thomas Davis <tadavis@lbl.gov>
-Signed-off-by: Jarod Wilson <jarod@redhat.com>
-Link: https://lore.kernel.org/r/20210119010927.1191922-1-jarod@redhat.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 5f9b32909659 ("bonding: provide a net pointer to __skb_flow_dissect()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/networking/bonding.rst | 13 +++++++++++
- drivers/net/bonding/bond_main.c      | 34 ++++++++++++++++++++++++++--
- drivers/net/bonding/bond_options.c   | 13 ++++++-----
- include/linux/netdevice.h            |  1 +
- include/uapi/linux/if_bonding.h      |  1 +
- 5 files changed, 54 insertions(+), 8 deletions(-)
-
-diff --git a/Documentation/networking/bonding.rst b/Documentation/networking/bonding.rst
-index 413dca513e1db..5390e79de5bb8 100644
---- a/Documentation/networking/bonding.rst
-+++ b/Documentation/networking/bonding.rst
-@@ -952,6 +952,19 @@ xmit_hash_policy
-               packets will be distributed according to the encapsulated
-               flows.
-+      vlan+srcmac
-+
-+              This policy uses a very rudimentary vlan ID and source mac
-+              hash to load-balance traffic per-vlan, with failover
-+              should one leg fail. The intended use case is for a bond
-+              shared by multiple virtual machines, all configured to
-+              use their own vlan, to give lacp-like functionality
-+              without requiring lacp-capable switching hardware.
-+
-+              The formula for the hash is simply
-+
-+              hash = (vlan ID) XOR (source MAC vendor) XOR (source MAC dev)
-+
-       The default value is layer2.  This option was added in bonding
-       version 2.6.3.  In earlier versions of bonding, this parameter
-       does not exist, and the layer2 policy is the only policy.  The
-diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
-index b4b2e6a7fdd40..2a6870a3b56dc 100644
---- a/drivers/net/bonding/bond_main.c
-+++ b/drivers/net/bonding/bond_main.c
-@@ -164,7 +164,7 @@ module_param(xmit_hash_policy, charp, 0);
- MODULE_PARM_DESC(xmit_hash_policy, "balance-alb, balance-tlb, balance-xor, 802.3ad hashing method; "
-                                  "0 for layer 2 (default), 1 for layer 3+4, "
-                                  "2 for layer 2+3, 3 for encap layer 2+3, "
--                                 "4 for encap layer 3+4");
-+                                 "4 for encap layer 3+4, 5 for vlan+srcmac");
- module_param(arp_interval, int, 0);
- MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds");
- module_param_array(arp_ip_target, charp, NULL, 0);
-@@ -1560,6 +1560,8 @@ static enum netdev_lag_hash bond_lag_hash_type(struct bonding *bond,
-               return NETDEV_LAG_HASH_E23;
-       case BOND_XMIT_POLICY_ENCAP34:
-               return NETDEV_LAG_HASH_E34;
-+      case BOND_XMIT_POLICY_VLAN_SRCMAC:
-+              return NETDEV_LAG_HASH_VLAN_SRCMAC;
-       default:
-               return NETDEV_LAG_HASH_UNKNOWN;
-       }
-@@ -3633,6 +3635,27 @@ static bool bond_flow_ip(struct sk_buff *skb, struct flow_keys *fk,
-       return true;
- }
-+static u32 bond_vlan_srcmac_hash(struct sk_buff *skb)
-+{
-+      struct ethhdr *mac_hdr = (struct ethhdr *)skb_mac_header(skb);
-+      u32 srcmac_vendor = 0, srcmac_dev = 0;
-+      u16 vlan;
-+      int i;
-+
-+      for (i = 0; i < 3; i++)
-+              srcmac_vendor = (srcmac_vendor << 8) | mac_hdr->h_source[i];
-+
-+      for (i = 3; i < ETH_ALEN; i++)
-+              srcmac_dev = (srcmac_dev << 8) | mac_hdr->h_source[i];
-+
-+      if (!skb_vlan_tag_present(skb))
-+              return srcmac_vendor ^ srcmac_dev;
-+
-+      vlan = skb_vlan_tag_get(skb);
-+
-+      return vlan ^ srcmac_vendor ^ srcmac_dev;
-+}
-+
- /* Extract the appropriate headers based on bond's xmit policy */
- static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
-                             struct flow_keys *fk)
-@@ -3640,10 +3663,14 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
-       bool l34 = bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34;
-       int noff, proto = -1;
--      if (bond->params.xmit_policy > BOND_XMIT_POLICY_LAYER23) {
-+      switch (bond->params.xmit_policy) {
-+      case BOND_XMIT_POLICY_ENCAP23:
-+      case BOND_XMIT_POLICY_ENCAP34:
-               memset(fk, 0, sizeof(*fk));
-               return __skb_flow_dissect(NULL, skb, &flow_keys_bonding,
-                                         fk, NULL, 0, 0, 0, 0);
-+      default:
-+              break;
-       }
-       fk->ports.ports = 0;
-@@ -3705,6 +3732,9 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
-           skb->l4_hash)
-               return skb->hash;
-+      if (bond->params.xmit_policy == BOND_XMIT_POLICY_VLAN_SRCMAC)
-+              return bond_vlan_srcmac_hash(skb);
-+
-       if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 ||
-           !bond_flow_dissect(bond, skb, &flow))
-               return bond_eth_hash(skb);
-diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
-index acc6185749945..2f2e4c4a84581 100644
---- a/drivers/net/bonding/bond_options.c
-+++ b/drivers/net/bonding/bond_options.c
-@@ -96,12 +96,13 @@ static const struct bond_opt_value bond_pps_tbl[] = {
- };
- static const struct bond_opt_value bond_xmit_hashtype_tbl[] = {
--      { "layer2",   BOND_XMIT_POLICY_LAYER2, BOND_VALFLAG_DEFAULT},
--      { "layer3+4", BOND_XMIT_POLICY_LAYER34, 0},
--      { "layer2+3", BOND_XMIT_POLICY_LAYER23, 0},
--      { "encap2+3", BOND_XMIT_POLICY_ENCAP23, 0},
--      { "encap3+4", BOND_XMIT_POLICY_ENCAP34, 0},
--      { NULL,       -1,                       0},
-+      { "layer2",      BOND_XMIT_POLICY_LAYER2,      BOND_VALFLAG_DEFAULT},
-+      { "layer3+4",    BOND_XMIT_POLICY_LAYER34,     0},
-+      { "layer2+3",    BOND_XMIT_POLICY_LAYER23,     0},
-+      { "encap2+3",    BOND_XMIT_POLICY_ENCAP23,     0},
-+      { "encap3+4",    BOND_XMIT_POLICY_ENCAP34,     0},
-+      { "vlan+srcmac", BOND_XMIT_POLICY_VLAN_SRCMAC, 0},
-+      { NULL,          -1,                           0},
- };
- static const struct bond_opt_value bond_arp_validate_tbl[] = {
-diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index dcf1b603cb516..3e0da2c9ff51d 100644
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -2670,6 +2670,7 @@ enum netdev_lag_hash {
-       NETDEV_LAG_HASH_L23,
-       NETDEV_LAG_HASH_E23,
-       NETDEV_LAG_HASH_E34,
-+      NETDEV_LAG_HASH_VLAN_SRCMAC,
-       NETDEV_LAG_HASH_UNKNOWN,
- };
-diff --git a/include/uapi/linux/if_bonding.h b/include/uapi/linux/if_bonding.h
-index 45f3750aa861b..e8eb4ad03cf18 100644
---- a/include/uapi/linux/if_bonding.h
-+++ b/include/uapi/linux/if_bonding.h
-@@ -94,6 +94,7 @@
- #define BOND_XMIT_POLICY_LAYER23      2 /* layer 2+3 (IP ^ MAC) */
- #define BOND_XMIT_POLICY_ENCAP23      3 /* encapsulated layer 2+3 */
- #define BOND_XMIT_POLICY_ENCAP34      4 /* encapsulated layer 3+4 */
-+#define BOND_XMIT_POLICY_VLAN_SRCMAC  5 /* vlan + source MAC */
- /* 802.3ad port state definitions (43.4.2.2 in the 802.3ad standard) */
- #define LACP_STATE_LACP_ACTIVITY   0x1
--- 
-2.51.0
-
index 652c5441bc791000868abd3ed37f7d00916a362b..b6ef73a1b40feab69f053f8ad0fe9035e34ccec4 100644 (file)
@@ -1,11 +1,11 @@
-From 2257a8697ce5ccbda1b82aa4218fadb9ebd7a579 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
+From 5f9b329096596b7e53e07d041d7fca4cbe1be752 Mon Sep 17 00:00:00 2001
+From: Eric Dumazet <edumazet@google.com>
 Date: Tue, 20 Jan 2026 16:17:44 +0000
 Subject: bonding: provide a net pointer to __skb_flow_dissect()
 
 From: Eric Dumazet <edumazet@google.com>
 
-[ Upstream commit 5f9b329096596b7e53e07d041d7fca4cbe1be752 ]
+commit 5f9b329096596b7e53e07d041d7fca4cbe1be752 upstream.
 
 After 3cbf4ffba5ee ("net: plumb network namespace into __skb_flow_dissect")
 we have to provide a net pointer to __skb_flow_dissect(),
@@ -41,27 +41,22 @@ Cc: Matteo Croce <mcroce@redhat.com>
 Acked-by: Stanislav Fomichev <sdf@fomichev.me>
 Link: https://patch.msgid.link/20260120161744.1893263-1-edumazet@google.com
 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 ---
- drivers/net/bonding/bond_main.c | 5 +++--
+ drivers/net/bonding/bond_main.c |    5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
-diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
-index 08d9aae7d5fc7..487105b24d7ac 100644
 --- a/drivers/net/bonding/bond_main.c
 +++ b/drivers/net/bonding/bond_main.c
-@@ -3692,8 +3692,9 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb, const v
-       case BOND_XMIT_POLICY_ENCAP23:
-       case BOND_XMIT_POLICY_ENCAP34:
+@@ -3642,8 +3642,9 @@ static bool bond_flow_dissect(struct bon
+       if (bond->params.xmit_policy > BOND_XMIT_POLICY_LAYER23) {
                memset(fk, 0, sizeof(*fk));
 -              return __skb_flow_dissect(NULL, skb, &flow_keys_bonding,
--                                        fk, data, l2_proto, nhoff, hlen, 0);
+-                                        fk, NULL, 0, 0, 0, 0);
 +              return __skb_flow_dissect(dev_net(bond->dev), skb,
-+                                        &flow_keys_bonding, fk, data,
-+                                        l2_proto, nhoff, hlen, 0);
-       default:
-               break;
++                                        &flow_keys_bonding, fk, NULL, 0, 0,
++                                        0, 0);
        }
--- 
-2.51.0
-
+       fk->ports.ports = 0;
diff --git a/queue-5.10/net-bonding-refactor-bond_xmit_hash-for-use-with-xdp.patch b/queue-5.10/net-bonding-refactor-bond_xmit_hash-for-use-with-xdp.patch
deleted file mode 100644 (file)
index 75f6550..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-From c5ec62e61dc7b1694e06920c529a4137440077af Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 31 Jul 2021 05:57:32 +0000
-Subject: net, bonding: Refactor bond_xmit_hash for use with xdp_buff
-
-From: Jussi Maki <joamaki@gmail.com>
-
-[ Upstream commit a815bde56b15ce626caaacc952ab12501671e45d ]
-
-In preparation for adding XDP support to the bonding driver
-refactor the packet hashing functions to be able to work with
-any linear data buffer without an skb.
-
-Signed-off-by: Jussi Maki <joamaki@gmail.com>
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Cc: Jay Vosburgh <j.vosburgh@gmail.com>
-Cc: Veaceslav Falico <vfalico@gmail.com>
-Cc: Andy Gospodarek <andy@greyhouse.net>
-Link: https://lore.kernel.org/bpf/20210731055738.16820-2-joamaki@gmail.com
-Stable-dep-of: 5f9b32909659 ("bonding: provide a net pointer to __skb_flow_dissect()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/bonding/bond_main.c | 147 +++++++++++++++++++-------------
- 1 file changed, 90 insertions(+), 57 deletions(-)
-
-diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
-index 2a6870a3b56dc..08d9aae7d5fc7 100644
---- a/drivers/net/bonding/bond_main.c
-+++ b/drivers/net/bonding/bond_main.c
-@@ -3593,55 +3593,80 @@ static struct notifier_block bond_netdev_notifier = {
- /*---------------------------- Hashing Policies -----------------------------*/
-+/* Helper to access data in a packet, with or without a backing skb.
-+ * If skb is given the data is linearized if necessary via pskb_may_pull.
-+ */
-+static inline const void *bond_pull_data(struct sk_buff *skb,
-+                                       const void *data, int hlen, int n)
-+{
-+      if (likely(n <= hlen))
-+              return data;
-+      else if (skb && likely(pskb_may_pull(skb, n)))
-+              return skb->head;
-+
-+      return NULL;
-+}
-+
- /* L2 hash helper */
--static inline u32 bond_eth_hash(struct sk_buff *skb)
-+static inline u32 bond_eth_hash(struct sk_buff *skb, const void *data, int mhoff, int hlen)
- {
--      struct ethhdr *ep, hdr_tmp;
-+      struct ethhdr *ep;
--      ep = skb_header_pointer(skb, 0, sizeof(hdr_tmp), &hdr_tmp);
--      if (ep)
--              return ep->h_dest[5] ^ ep->h_source[5] ^ ep->h_proto;
--      return 0;
-+      data = bond_pull_data(skb, data, hlen, mhoff + sizeof(struct ethhdr));
-+      if (!data)
-+              return 0;
-+
-+      ep = (struct ethhdr *)(data + mhoff);
-+      return ep->h_dest[5] ^ ep->h_source[5] ^ ep->h_proto;
- }
--static bool bond_flow_ip(struct sk_buff *skb, struct flow_keys *fk,
--                       int *noff, int *proto, bool l34)
-+static bool bond_flow_ip(struct sk_buff *skb, struct flow_keys *fk, const void *data,
-+                       int hlen, __be16 l2_proto, int *nhoff, int *ip_proto, bool l34)
- {
-       const struct ipv6hdr *iph6;
-       const struct iphdr *iph;
--      if (skb->protocol == htons(ETH_P_IP)) {
--              if (unlikely(!pskb_may_pull(skb, *noff + sizeof(*iph))))
-+      if (l2_proto == htons(ETH_P_IP)) {
-+              data = bond_pull_data(skb, data, hlen, *nhoff + sizeof(*iph));
-+              if (!data)
-                       return false;
--              iph = (const struct iphdr *)(skb->data + *noff);
-+
-+              iph = (const struct iphdr *)(data + *nhoff);
-               iph_to_flow_copy_v4addrs(fk, iph);
--              *noff += iph->ihl << 2;
-+              *nhoff += iph->ihl << 2;
-               if (!ip_is_fragment(iph))
--                      *proto = iph->protocol;
--      } else if (skb->protocol == htons(ETH_P_IPV6)) {
--              if (unlikely(!pskb_may_pull(skb, *noff + sizeof(*iph6))))
-+                      *ip_proto = iph->protocol;
-+      } else if (l2_proto == htons(ETH_P_IPV6)) {
-+              data = bond_pull_data(skb, data, hlen, *nhoff + sizeof(*iph6));
-+              if (!data)
-                       return false;
--              iph6 = (const struct ipv6hdr *)(skb->data + *noff);
-+
-+              iph6 = (const struct ipv6hdr *)(data + *nhoff);
-               iph_to_flow_copy_v6addrs(fk, iph6);
--              *noff += sizeof(*iph6);
--              *proto = iph6->nexthdr;
-+              *nhoff += sizeof(*iph6);
-+              *ip_proto = iph6->nexthdr;
-       } else {
-               return false;
-       }
--      if (l34 && *proto >= 0)
--              fk->ports.ports = skb_flow_get_ports(skb, *noff, *proto);
-+      if (l34 && *ip_proto >= 0)
-+              fk->ports.ports = __skb_flow_get_ports(skb, *nhoff, *ip_proto, data, hlen);
-       return true;
- }
--static u32 bond_vlan_srcmac_hash(struct sk_buff *skb)
-+static u32 bond_vlan_srcmac_hash(struct sk_buff *skb, const void *data, int mhoff, int hlen)
- {
--      struct ethhdr *mac_hdr = (struct ethhdr *)skb_mac_header(skb);
-+      struct ethhdr *mac_hdr;
-       u32 srcmac_vendor = 0, srcmac_dev = 0;
-       u16 vlan;
-       int i;
-+      data = bond_pull_data(skb, data, hlen, mhoff + sizeof(struct ethhdr));
-+      if (!data)
-+              return 0;
-+      mac_hdr = (struct ethhdr *)(data + mhoff);
-+
-       for (i = 0; i < 3; i++)
-               srcmac_vendor = (srcmac_vendor << 8) | mac_hdr->h_source[i];
-@@ -3657,26 +3682,25 @@ static u32 bond_vlan_srcmac_hash(struct sk_buff *skb)
- }
- /* Extract the appropriate headers based on bond's xmit policy */
--static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
--                            struct flow_keys *fk)
-+static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb, const void *data,
-+                            __be16 l2_proto, int nhoff, int hlen, struct flow_keys *fk)
- {
-       bool l34 = bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34;
--      int noff, proto = -1;
-+      int ip_proto = -1;
-       switch (bond->params.xmit_policy) {
-       case BOND_XMIT_POLICY_ENCAP23:
-       case BOND_XMIT_POLICY_ENCAP34:
-               memset(fk, 0, sizeof(*fk));
-               return __skb_flow_dissect(NULL, skb, &flow_keys_bonding,
--                                        fk, NULL, 0, 0, 0, 0);
-+                                        fk, data, l2_proto, nhoff, hlen, 0);
-       default:
-               break;
-       }
-       fk->ports.ports = 0;
-       memset(&fk->icmp, 0, sizeof(fk->icmp));
--      noff = skb_network_offset(skb);
--      if (!bond_flow_ip(skb, fk, &noff, &proto, l34))
-+      if (!bond_flow_ip(skb, fk, data, hlen, l2_proto, &nhoff, &ip_proto, l34))
-               return false;
-       /* ICMP error packets contains at least 8 bytes of the header
-@@ -3684,22 +3708,20 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
-        * to correlate ICMP error packets within the same flow which
-        * generated the error.
-        */
--      if (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6) {
--              skb_flow_get_icmp_tci(skb, &fk->icmp, skb->data,
--                                    skb_transport_offset(skb),
--                                    skb_headlen(skb));
--              if (proto == IPPROTO_ICMP) {
-+      if (ip_proto == IPPROTO_ICMP || ip_proto == IPPROTO_ICMPV6) {
-+              skb_flow_get_icmp_tci(skb, &fk->icmp, data, nhoff, hlen);
-+              if (ip_proto == IPPROTO_ICMP) {
-                       if (!icmp_is_err(fk->icmp.type))
-                               return true;
--                      noff += sizeof(struct icmphdr);
--              } else if (proto == IPPROTO_ICMPV6) {
-+                      nhoff += sizeof(struct icmphdr);
-+              } else if (ip_proto == IPPROTO_ICMPV6) {
-                       if (!icmpv6_is_err(fk->icmp.type))
-                               return true;
--                      noff += sizeof(struct icmp6hdr);
-+                      nhoff += sizeof(struct icmp6hdr);
-               }
--              return bond_flow_ip(skb, fk, &noff, &proto, l34);
-+              return bond_flow_ip(skb, fk, data, hlen, l2_proto, &nhoff, &ip_proto, l34);
-       }
-       return true;
-@@ -3715,33 +3737,26 @@ static u32 bond_ip_hash(u32 hash, struct flow_keys *flow)
-       return hash >> 1;
- }
--/**
-- * bond_xmit_hash - generate a hash value based on the xmit policy
-- * @bond: bonding device
-- * @skb: buffer to use for headers
-- *
-- * This function will extract the necessary headers from the skb buffer and use
-- * them to generate a hash based on the xmit_policy set in the bonding device
-+/* Generate hash based on xmit policy. If @skb is given it is used to linearize
-+ * the data as required, but this function can be used without it if the data is
-+ * known to be linear (e.g. with xdp_buff).
-  */
--u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
-+static u32 __bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, const void *data,
-+                          __be16 l2_proto, int mhoff, int nhoff, int hlen)
- {
-       struct flow_keys flow;
-       u32 hash;
--      if (bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP34 &&
--          skb->l4_hash)
--              return skb->hash;
--
-       if (bond->params.xmit_policy == BOND_XMIT_POLICY_VLAN_SRCMAC)
--              return bond_vlan_srcmac_hash(skb);
-+              return bond_vlan_srcmac_hash(skb, data, mhoff, hlen);
-       if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER2 ||
--          !bond_flow_dissect(bond, skb, &flow))
--              return bond_eth_hash(skb);
-+          !bond_flow_dissect(bond, skb, data, l2_proto, nhoff, hlen, &flow))
-+              return bond_eth_hash(skb, data, mhoff, hlen);
-       if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER23 ||
-           bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP23) {
--              hash = bond_eth_hash(skb);
-+              hash = bond_eth_hash(skb, data, mhoff, hlen);
-       } else {
-               if (flow.icmp.id)
-                       memcpy(&hash, &flow.icmp, sizeof(hash));
-@@ -3752,6 +3767,25 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
-       return bond_ip_hash(hash, &flow);
- }
-+/**
-+ * bond_xmit_hash - generate a hash value based on the xmit policy
-+ * @bond: bonding device
-+ * @skb: buffer to use for headers
-+ *
-+ * This function will extract the necessary headers from the skb buffer and use
-+ * them to generate a hash based on the xmit_policy set in the bonding device
-+ */
-+u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
-+{
-+      if (bond->params.xmit_policy == BOND_XMIT_POLICY_ENCAP34 &&
-+          skb->l4_hash)
-+              return skb->hash;
-+
-+      return __bond_xmit_hash(bond, skb, skb->head, skb->protocol,
-+                              skb->mac_header, skb->network_header,
-+                              skb_headlen(skb));
-+}
-+
- /*-------------------------- Device entry points ----------------------------*/
- void bond_work_init_all(struct bonding *bond)
-@@ -4398,8 +4432,7 @@ static netdev_tx_t bond_xmit_roundrobin(struct sk_buff *skb,
-       return bond_tx_drop(bond_dev, skb);
- }
--static struct slave *bond_xmit_activebackup_slave_get(struct bonding *bond,
--                                                    struct sk_buff *skb)
-+static struct slave *bond_xmit_activebackup_slave_get(struct bonding *bond)
- {
-       return rcu_dereference(bond->curr_active_slave);
- }
-@@ -4413,7 +4446,7 @@ static netdev_tx_t bond_xmit_activebackup(struct sk_buff *skb,
-       struct bonding *bond = netdev_priv(bond_dev);
-       struct slave *slave;
--      slave = bond_xmit_activebackup_slave_get(bond, skb);
-+      slave = bond_xmit_activebackup_slave_get(bond);
-       if (slave)
-               return bond_dev_queue_xmit(bond, skb, slave->dev);
-@@ -4724,7 +4757,7 @@ static struct net_device *bond_xmit_get_slave(struct net_device *master_dev,
-               slave = bond_xmit_roundrobin_slave_get(bond, skb);
-               break;
-       case BOND_MODE_ACTIVEBACKUP:
--              slave = bond_xmit_activebackup_slave_get(bond, skb);
-+              slave = bond_xmit_activebackup_slave_get(bond);
-               break;
-       case BOND_MODE_8023AD:
-       case BOND_MODE_XOR:
--- 
-2.51.0
-
diff --git a/queue-5.10/net-bonding-take-ip-hash-logic-into-a-helper.patch b/queue-5.10/net-bonding-take-ip-hash-logic-into-a-helper.patch
deleted file mode 100644 (file)
index d067b54..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-From 4d7dcee5006c62899e19faf8ac5a839bb1865ab7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 17 Jan 2021 16:59:43 +0200
-Subject: net/bonding: Take IP hash logic into a helper
-
-From: Tariq Toukan <tariqt@nvidia.com>
-
-[ Upstream commit 5b99854540e35c2c6a226bcdb4bafbae1bccad5a ]
-
-Hash logic on L3 will be used in a downstream patch for one more use
-case.
-Take it to a function for a better code reuse.
-
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Boris Pismenny <borisp@nvidia.com>
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 5f9b32909659 ("bonding: provide a net pointer to __skb_flow_dissect()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/bonding/bond_main.c | 16 +++++++++++-----
- 1 file changed, 11 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
-index 08bc930afc4cf..b4b2e6a7fdd40 100644
---- a/drivers/net/bonding/bond_main.c
-+++ b/drivers/net/bonding/bond_main.c
-@@ -3678,6 +3678,16 @@ static bool bond_flow_dissect(struct bonding *bond, struct sk_buff *skb,
-       return true;
- }
-+static u32 bond_ip_hash(u32 hash, struct flow_keys *flow)
-+{
-+      hash ^= (__force u32)flow_get_u32_dst(flow) ^
-+              (__force u32)flow_get_u32_src(flow);
-+      hash ^= (hash >> 16);
-+      hash ^= (hash >> 8);
-+      /* discard lowest hash bit to deal with the common even ports pattern */
-+      return hash >> 1;
-+}
-+
- /**
-  * bond_xmit_hash - generate a hash value based on the xmit policy
-  * @bond: bonding device
-@@ -3708,12 +3718,8 @@ u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb)
-               else
-                       memcpy(&hash, &flow.ports.ports, sizeof(hash));
-       }
--      hash ^= (__force u32)flow_get_u32_dst(&flow) ^
--              (__force u32)flow_get_u32_src(&flow);
--      hash ^= (hash >> 16);
--      hash ^= (hash >> 8);
--      return hash >> 1;
-+      return bond_ip_hash(hash, &flow);
- }
- /*-------------------------- Device entry points ----------------------------*/
--- 
-2.51.0
-
index 84018bb97027c1353064dc0c2267429d19ec38fc..6398170e1259cef51914025575d6d262c69f14fc 100644 (file)
@@ -81,9 +81,6 @@ scsi-hisi_sas-use-managed-pci-functions.patch
 drm-amd-pm-don-t-clear-si-smc-table-when-setting-pow.patch
 drm-amd-pm-workaround-si-powertune-issue-on-radeon-4.patch
 be2net-fix-null-pointer-dereference-in-be_cmd_get_ma.patch
-net-bonding-take-ip-hash-logic-into-a-helper.patch
-bonding-add-a-vlan-srcmac-tx-hashing-option.patch
-net-bonding-refactor-bond_xmit_hash-for-use-with-xdp.patch
 bonding-provide-a-net-pointer-to-__skb_flow_dissect.patch
 octeontx2-af-fix-error-handling.patch
 net-sched-act_ife-avoid-possible-null-deref.patch