gpio-nct5104d: fix compilation with kernel 6.6
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 880-v5.19-cdc_ether-export-usbnet_cdc_zte_rx_fixup.patch
1 From a79a5613e1907e1bf09bb6ba6fd5ff43b66c1afe Mon Sep 17 00:00:00 2001
2 From: Lech Perczak <lech.perczak@gmail.com>
3 Date: Fri, 1 Apr 2022 22:03:55 +0200
4 Subject: [PATCH 1/3] cdc_ether: export usbnet_cdc_zte_rx_fixup
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Commit bfe9b9d2df66 ("cdc_ether: Improve ZTE MF823/831/910 handling")
10 introduces a workaround for certain ZTE modems reporting invalid MAC
11 addresses over CDC-ECM.
12 The same issue was present on their RNDIS interface,which was fixed in
13 commit a5a18bdf7453 ("rndis_host: Set valid random MAC on buggy devices").
14
15 However, internal modem of ZTE MF286R router, on its RNDIS interface, also
16 exhibits a second issue fixed already in CDC-ECM, of the device not
17 respecting configured random MAC address. In order to share the fixup for
18 this with rndis_host driver, export the workaround function, which will
19 be re-used in the following commit in rndis_host.
20
21 Cc: Kristian Evensen <kristian.evensen@gmail.com>
22 Cc: Bjørn Mork <bjorn@mork.no>
23 Cc: Oliver Neukum <oliver@neukum.org>
24 Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
25 ---
26 drivers/net/usb/cdc_ether.c | 3 ++-
27 include/linux/usb/usbnet.h | 1 +
28 2 files changed, 3 insertions(+), 1 deletion(-)
29
30 --- a/drivers/net/usb/cdc_ether.c
31 +++ b/drivers/net/usb/cdc_ether.c
32 @@ -479,7 +479,7 @@ static int usbnet_cdc_zte_bind(struct us
33 * device MAC address has been updated). Always set MAC address to that of the
34 * device.
35 */
36 -static int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
37 +int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
38 {
39 if (skb->len < ETH_HLEN || !(skb->data[0] & 0x02))
40 return 1;
41 @@ -489,6 +489,7 @@ static int usbnet_cdc_zte_rx_fixup(struc
42
43 return 1;
44 }
45 +EXPORT_SYMBOL_GPL(usbnet_cdc_zte_rx_fixup);
46
47 /* Ensure correct link state
48 *
49 --- a/include/linux/usb/usbnet.h
50 +++ b/include/linux/usb/usbnet.h
51 @@ -214,6 +214,7 @@ extern int usbnet_ether_cdc_bind(struct
52 extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
53 extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
54 extern void usbnet_cdc_status(struct usbnet *, struct urb *);
55 +extern int usbnet_cdc_zte_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
56
57 /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
58 #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \