[openwrt/openwrt] kernel: 5.10: simplify logic in packet mangling patch
LEDE Commits
lede-commits at lists.infradead.org
Tue Nov 2 15:28:21 PDT 2021
mkresin pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/f7f12495bc9725e221b595680c47c4240d437abb
commit f7f12495bc9725e221b595680c47c4240d437abb
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Oct 23 21:14:04 2021 +0200
kernel: 5.10: simplify logic in packet mangling patch
I had quite a hard time to understand what the change to net/core/dev.c
is supposed to do.
Simplify the change by returning NETDEV_TX_OK in case a eth_mangle_tx
callback was set but returned NULL instead of setting the return value
in the else branch.
Signed-off-by: Mathias Kresin <dev at kresin.me>
---
.../hack-5.10/721-net-add-packet-mangeling.patch | 29 ++++++----------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch
index f656472ef9..26ed829363 100644
--- a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch
+++ b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch
@@ -105,33 +105,18 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
-@@ -3638,11 +3638,21 @@ static int xmit_one(struct sk_buff *skb,
+@@ -3638,6 +3638,11 @@ static int xmit_one(struct sk_buff *skb,
if (dev_nit_active(dev))
dev_queue_xmit_nit(skb, dev);
-- len = skb->len;
-- PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies);
-- trace_net_dev_start_xmit(skb, dev);
-- rc = netdev_start_xmit(skb, dev, txq, more);
-- trace_net_dev_xmit(skb, rc, dev, len);
+#ifdef CONFIG_ETHERNET_PACKET_MANGLE
-+ if (!dev->eth_mangle_tx ||
-+ (skb = dev->eth_mangle_tx(dev, skb)) != NULL)
-+#else
-+ if (1)
++ if (dev->eth_mangle_tx && !(skb = dev->eth_mangle_tx(dev, skb)))
++ return NETDEV_TX_OK;
+#endif
-+ {
-+ len = skb->len;
-+ PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies);
-+ trace_net_dev_start_xmit(skb, dev);
-+ rc = netdev_start_xmit(skb, dev, txq, more);
-+ trace_net_dev_xmit(skb, rc, dev, len);
-+ } else {
-+ rc = NETDEV_TX_OK;
-+ }
-
- return rc;
- }
++
+ len = skb->len;
+ PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies);
+ trace_net_dev_start_xmit(skb, dev);
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -60,6 +60,7 @@
More information about the lede-commits
mailing list