From: Sasha Levin Date: Thu, 12 Sep 2024 12:21:00 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v6.1.111~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9978c1f9d072687d74cf47f0c151df139e28433b;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch b/queue-5.4/net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch new file mode 100644 index 00000000000..b0907dc78cf --- /dev/null +++ b/queue-5.4/net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch @@ -0,0 +1,50 @@ +From 3cd447b00f28c14ae1a76f32922cd1a7cc832556 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 7 Aug 2024 19:07:21 +0900 +Subject: net: ethernet: use ip_hdrlen() instead of bit shift + +From: Moon Yeounsu + +[ Upstream commit 9a039eeb71a42c8b13408a1976e300f3898e1be0 ] + +`ip_hdr(skb)->ihl << 2` is the same as `ip_hdrlen(skb)` +Therefore, we should use a well-defined function not a bit shift +to find the header length. + +It also compresses two lines to a single line. + +Signed-off-by: Moon Yeounsu +Reviewed-by: Christophe JAILLET +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/jme.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c +index 25aa400e2e3c..773ec50d515b 100644 +--- a/drivers/net/ethernet/jme.c ++++ b/drivers/net/ethernet/jme.c +@@ -947,15 +947,13 @@ jme_udpsum(struct sk_buff *skb) + if (skb->protocol != htons(ETH_P_IP)) + return csum; + skb_set_network_header(skb, ETH_HLEN); +- if ((ip_hdr(skb)->protocol != IPPROTO_UDP) || +- (skb->len < (ETH_HLEN + +- (ip_hdr(skb)->ihl << 2) + +- sizeof(struct udphdr)))) { ++ ++ if (ip_hdr(skb)->protocol != IPPROTO_UDP || ++ skb->len < (ETH_HLEN + ip_hdrlen(skb) + sizeof(struct udphdr))) { + skb_reset_network_header(skb); + return csum; + } +- skb_set_transport_header(skb, +- ETH_HLEN + (ip_hdr(skb)->ihl << 2)); ++ skb_set_transport_header(skb, ETH_HLEN + ip_hdrlen(skb)); + csum = udp_hdr(skb)->check; + skb_reset_transport_header(skb); + skb_reset_network_header(skb); +-- +2.43.0 + diff --git a/queue-5.4/net-phy-vitesse-repair-vsc73xx-autonegotiation.patch b/queue-5.4/net-phy-vitesse-repair-vsc73xx-autonegotiation.patch new file mode 100644 index 00000000000..d99034043b9 --- /dev/null +++ b/queue-5.4/net-phy-vitesse-repair-vsc73xx-autonegotiation.patch @@ -0,0 +1,76 @@ +From d4cf80ac8d8a31474f1042892b4f1a7addbe7700 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Aug 2024 21:38:06 +0200 +Subject: net: phy: vitesse: repair vsc73xx autonegotiation + +From: Pawel Dembicki + +[ Upstream commit de7a670f8defe4ed2115552ad23dea0f432f7be4 ] + +When the vsc73xx mdio bus work properly, the generic autonegotiation +configuration works well. + +Reviewed-by: Linus Walleij +Signed-off-by: Pawel Dembicki +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/phy/vitesse.c | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c +index bb680352708a..3f594c8784e2 100644 +--- a/drivers/net/phy/vitesse.c ++++ b/drivers/net/phy/vitesse.c +@@ -232,16 +232,6 @@ static int vsc739x_config_init(struct phy_device *phydev) + return 0; + } + +-static int vsc73xx_config_aneg(struct phy_device *phydev) +-{ +- /* The VSC73xx switches does not like to be instructed to +- * do autonegotiation in any way, it prefers that you just go +- * with the power-on/reset defaults. Writing some registers will +- * just make autonegotiation permanently fail. +- */ +- return 0; +-} +- + /* This adds a skew for both TX and RX clocks, so the skew should only be + * applied to "rgmii-id" interfaces. It may not work as expected + * on "rgmii-txid", "rgmii-rxid" or "rgmii" interfaces. */ +@@ -424,7 +414,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + /* PHY_GBIT_FEATURES */ + .config_init = vsc738x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +@@ -433,7 +422,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + /* PHY_GBIT_FEATURES */ + .config_init = vsc738x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +@@ -442,7 +430,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + /* PHY_GBIT_FEATURES */ + .config_init = vsc739x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +@@ -451,7 +438,6 @@ static struct phy_driver vsc82xx_driver[] = { + .phy_id_mask = 0x000ffff0, + /* PHY_GBIT_FEATURES */ + .config_init = vsc739x_config_init, +- .config_aneg = vsc73xx_config_aneg, + .read_page = vsc73xx_read_page, + .write_page = vsc73xx_write_page, + }, { +-- +2.43.0 + diff --git a/queue-5.4/scripts-kconfig-merge_config-config-files-add-a-trai.patch b/queue-5.4/scripts-kconfig-merge_config-config-files-add-a-trai.patch new file mode 100644 index 00000000000..8005c8a4839 --- /dev/null +++ b/queue-5.4/scripts-kconfig-merge_config-config-files-add-a-trai.patch @@ -0,0 +1,48 @@ +From b76cd86043d9423758669099198fadb6319192bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Aug 2024 11:22:34 +0200 +Subject: scripts: kconfig: merge_config: config files: add a trailing newline + +From: Anders Roxell + +[ Upstream commit 33330bcf031818e60a816db0cfd3add9eecc3b28 ] + +When merging files without trailing newlines at the end of the file, two +config fragments end up at the same row if file1.config doens't have a +trailing newline at the end of the file. + +file1.config "CONFIG_1=y" +file2.config "CONFIG_2=y" +./scripts/kconfig/merge_config.sh -m .config file1.config file2.config + +This will generate a .config looking like this. +cat .config +... +CONFIG_1=yCONFIG_2=y" + +Making sure so we add a newline at the end of every config file that is +passed into the script. + +Signed-off-by: Anders Roxell +Signed-off-by: Masahiro Yamada +Signed-off-by: Sasha Levin +--- + scripts/kconfig/merge_config.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh +index 63c8565206a4..d7d5c58b8b6a 100755 +--- a/scripts/kconfig/merge_config.sh ++++ b/scripts/kconfig/merge_config.sh +@@ -150,6 +150,8 @@ for ORIG_MERGE_FILE in $MERGE_LIST ; do + sed -i "/$CFG[ =]/d" $MERGE_FILE + fi + done ++ # In case the previous file lacks a new line at the end ++ echo >> $TMP_FILE + cat $MERGE_FILE >> $TMP_FILE + done + +-- +2.43.0 + diff --git a/queue-5.4/series b/queue-5.4/series new file mode 100644 index 00000000000..7e243bdcbe4 --- /dev/null +++ b/queue-5.4/series @@ -0,0 +1,4 @@ +usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch +net-ethernet-use-ip_hdrlen-instead-of-bit-shift.patch +net-phy-vitesse-repair-vsc73xx-autonegotiation.patch +scripts-kconfig-merge_config-config-files-add-a-trai.patch diff --git a/queue-5.4/usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch b/queue-5.4/usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch new file mode 100644 index 00000000000..c1d672e839c --- /dev/null +++ b/queue-5.4/usbnet-ipheth-fix-carrier-detection-in-modes-1-and-4.patch @@ -0,0 +1,80 @@ +From 35b8bd6e7ef0744d98b79bffd83fb5327d3f40db Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 6 Aug 2024 19:28:09 +0200 +Subject: usbnet: ipheth: fix carrier detection in modes 1 and 4 + +From: Foster Snowhill + +[ Upstream commit 67927a1b255d883881be9467508e0af9a5e0be9d ] + +Apart from the standard "configurations", "interfaces" and "alternate +interface settings" in USB, iOS devices also have a notion of +"modes". In different modes, the device exposes a different set of +available configurations. + +Depending on the iOS version, and depending on the current mode, the +length and contents of the carrier state control message differs: + +* 1 byte (seen on iOS 4.2.1, 8.4): + * 03: carrier off (mode 0) + * 04: carrier on (mode 0) +* 3 bytes (seen on iOS 10.3.4, 15.7.6): + * 03 03 03: carrier off (mode 0) + * 04 04 03: carrier on (mode 0) +* 4 bytes (seen on iOS 16.5, 17.6): + * 03 03 03 00: carrier off (mode 0) + * 04 03 03 00: carrier off (mode 1) + * 06 03 03 00: carrier off (mode 4) + * 04 04 03 04: carrier on (mode 0 and 1) + * 06 04 03 04: carrier on (mode 4) + +Before this change, the driver always used the first byte of the +response to determine carrier state. + +From this larger sample, the first byte seems to indicate the number of +available USB configurations in the current mode (with the exception of +the default mode 0), and in some cases (namely mode 1 and 4) does not +correlate with the carrier state. + +Previous logic erroneously counted `04 03 03 00` as "carrier on" and +`06 04 03 04` as "carrier off" on iOS versions that support mode 1 and +mode 4 respectively. + +Only modes 0, 1 and 4 expose the USB Ethernet interfaces necessary for +the ipheth driver. + +Check the second byte of the control message where possible, and fall +back to checking the first byte on older iOS versions. + +Signed-off-by: Foster Snowhill +Tested-by: Georgi Valkov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/ipheth.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c +index 05576f66f73d..4a6f9dc71dfb 100644 +--- a/drivers/net/usb/ipheth.c ++++ b/drivers/net/usb/ipheth.c +@@ -253,13 +253,14 @@ static int ipheth_carrier_set(struct ipheth_device *dev) + 0x02, /* index */ + dev->ctrl_buf, IPHETH_CTRL_BUF_SIZE, + IPHETH_CTRL_TIMEOUT); +- if (retval < 0) { ++ if (retval <= 0) { + dev_err(&dev->intf->dev, "%s: usb_control_msg: %d\n", + __func__, retval); + return retval; + } + +- if (dev->ctrl_buf[0] == IPHETH_CARRIER_ON) { ++ if ((retval == 1 && dev->ctrl_buf[0] == IPHETH_CARRIER_ON) || ++ (retval >= 2 && dev->ctrl_buf[1] == IPHETH_CARRIER_ON)) { + netif_carrier_on(dev->net); + if (dev->tx_urb->status != -EINPROGRESS) + netif_wake_queue(dev->net); +-- +2.43.0 +