[openwrt/openwrt] kernel: fix mtk dsa tag padding

LEDE Commits lede-commits at lists.infradead.org
Thu Mar 2 04:00:27 PST 2023


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/9307c27539805de021fb7163f6ad6dc08992331b

commit 9307c27539805de021fb7163f6ad6dc08992331b
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Mar 2 12:58:16 2023 +0100

    kernel: fix mtk dsa tag padding
    
    The padding intended to avoid corrupted non-zero padding payload was
    accidentally adding too many padding bytes, tripping up some setups.
    Fix this by using eth_skb_pad instead.
    Fixes #11942.
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch            | 5 ++---
 .../705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch            | 5 ++---
 .../732-05-net-dsa-tag_mtk-assign-per-port-queues.patch             | 6 +++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/target/linux/generic/pending-5.10/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch b/target/linux/generic/pending-5.10/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
index e27ac3595f..4f3af6c6b0 100644
--- a/target/linux/generic/pending-5.10/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
+++ b/target/linux/generic/pending-5.10/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
@@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/net/dsa/tag_mtk.c
 +++ b/net/dsa/tag_mtk.c
-@@ -25,6 +25,14 @@ static struct sk_buff *mtk_tag_xmit(stru
+@@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
  	u8 xmit_tpid;
  	u8 *mtk_tag;
  
@@ -21,8 +21,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +	 * corrupted. With tags enabled, we need to make sure that packets are
 +	 * at least 68 bytes (including FCS and tag).
 +	 */
-+	if (__skb_put_padto(skb, ETH_ZLEN + MTK_HDR_LEN, false))
-+		return NULL;
++	eth_skb_pad(skb);
 +
  	/* Build the special tag after the MAC Source Address. If VLAN header
  	 * is present, it's required that VLAN header and special tag is
diff --git a/target/linux/generic/pending-5.15/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch b/target/linux/generic/pending-5.15/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
index e27ac3595f..4f3af6c6b0 100644
--- a/target/linux/generic/pending-5.15/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
+++ b/target/linux/generic/pending-5.15/705-net-dsa-tag_mtk-add-padding-for-tx-packets.patch
@@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/net/dsa/tag_mtk.c
 +++ b/net/dsa/tag_mtk.c
-@@ -25,6 +25,14 @@ static struct sk_buff *mtk_tag_xmit(stru
+@@ -25,6 +25,13 @@ static struct sk_buff *mtk_tag_xmit(stru
  	u8 xmit_tpid;
  	u8 *mtk_tag;
  
@@ -21,8 +21,7 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 +	 * corrupted. With tags enabled, we need to make sure that packets are
 +	 * at least 68 bytes (including FCS and tag).
 +	 */
-+	if (__skb_put_padto(skb, ETH_ZLEN + MTK_HDR_LEN, false))
-+		return NULL;
++	eth_skb_pad(skb);
 +
  	/* Build the special tag after the MAC Source Address. If VLAN header
  	 * is present, it's required that VLAN header and special tag is
diff --git a/target/linux/generic/pending-5.15/732-05-net-dsa-tag_mtk-assign-per-port-queues.patch b/target/linux/generic/pending-5.15/732-05-net-dsa-tag_mtk-assign-per-port-queues.patch
index 7739366ade..e8c9631819 100644
--- a/target/linux/generic/pending-5.15/732-05-net-dsa-tag_mtk-assign-per-port-queues.patch
+++ b/target/linux/generic/pending-5.15/732-05-net-dsa-tag_mtk-assign-per-port-queues.patch
@@ -9,9 +9,9 @@ Signed-off-by: Felix Fietkau <nbd at nbd.name>
 
 --- a/net/dsa/tag_mtk.c
 +++ b/net/dsa/tag_mtk.c
-@@ -33,6 +33,8 @@ static struct sk_buff *mtk_tag_xmit(stru
- 	if (__skb_put_padto(skb, ETH_ZLEN + MTK_HDR_LEN, false))
- 		return NULL;
+@@ -32,6 +32,8 @@ static struct sk_buff *mtk_tag_xmit(stru
+ 	 */
+ 	eth_skb_pad(skb);
  
 +	skb_set_queue_mapping(skb, dp->index);
 +




More information about the lede-commits mailing list