* [PATCH 3/4] cdc_ncm: replace the way cdc_ncm hooks into
@ 2020-07-15 15:56 Wxcafé
2020-07-16 8:19 ` Sergei Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Wxcafé @ 2020-07-15 15:56 UTC (permalink / raw)
To: linux-usb; +Cc: Miguel Rodríguez Pérez, oliver, netdev
From 352445fcbac243b8f10e1840726d67b41a45853d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel Rodr=C3=ADguez P=C3=A9rez? <miguel@det.uvigo.gal>
Date: Tue, 14 Jul 2020 18:10:34 -0400
Subject: [PATCH 3/4] cdc_ncm: replace the way cdc_ncm hooks into
usbnet_change_mtu
Previously cdc_ncm overwrited netdev_ops used by usbnet
thus preventing hooking into set_rx_mode. This patch
preserves usbnet hooks into netdev_ops, and add an
additional one for change_mtu needed by cdc_ncm.
Signed-off-by: Miguel Rodríguez Pérez <miguel@det.uvigo.gal>
Signed-off-by: Wxcafé <wxcafe@wxcafe.net>
---
drivers/net/usb/cdc_ncm.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 8929669b5e6d..2abaf5f8b23b 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -787,16 +787,7 @@ int cdc_ncm_change_mtu(struct net_device *net, int new_mtu)
}
EXPORT_SYMBOL_GPL(cdc_ncm_change_mtu);
-static const struct net_device_ops cdc_ncm_netdev_ops = {
- .ndo_open = usbnet_open,
- .ndo_stop = usbnet_stop,
- .ndo_start_xmit = usbnet_start_xmit,
- .ndo_tx_timeout = usbnet_tx_timeout,
- .ndo_get_stats64 = usbnet_get_stats64,
- .ndo_change_mtu = cdc_ncm_change_mtu,
- .ndo_set_mac_address = eth_mac_addr,
- .ndo_validate_addr = eth_validate_addr,
-};
+static struct net_device_ops cdc_ncm_netdev_ops;
int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting, int drvflags)
{
@@ -953,6 +944,8 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
dev->net->sysfs_groups[0] = &cdc_ncm_sysfs_attr_group;
/* must handle MTU changes */
+ cdc_ncm_netdev_ops = *dev->net->netdev_ops;
+ cdc_ncm_netdev_ops.ndo_change_mtu = cdc_ncm_change_mtu;
dev->net->netdev_ops = &cdc_ncm_netdev_ops;
dev->net->max_mtu = cdc_ncm_max_dgram_size(dev) - cdc_ncm_eth_hlen(dev);
--
2.27.0
--
Wxcafé <wxcafe@wxcafe.net>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/4] cdc_ncm: replace the way cdc_ncm hooks into
2020-07-15 15:56 [PATCH 3/4] cdc_ncm: replace the way cdc_ncm hooks into Wxcafé
@ 2020-07-16 8:19 ` Sergei Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2020-07-16 8:19 UTC (permalink / raw)
To: Wxcafé, linux-usb; +Cc: Miguel Rodríguez Pérez, oliver, netdev
Hello!
On 15.07.2020 18:56, Wxcafé wrote:
> From 352445fcbac243b8f10e1840726d67b41a45853d Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Miguel Rodr=C3=ADguez P=C3=A9rez? <miguel@det.uvigo.gal>
Something went wrong
> Date: Tue, 14 Jul 2020 18:10:34 -0400
> Subject: [PATCH 3/4] cdc_ncm: replace the way cdc_ncm hooks into
> usbnet_change_mtu
You don't need the above, except for From:...
> Previously cdc_ncm overwrited netdev_ops used by usbnet
Overwrote.
> thus preventing hooking into set_rx_mode. This patch
> preserves usbnet hooks into netdev_ops, and add an
> additional one for change_mtu needed by cdc_ncm.
>
> Signed-off-by: Miguel Rodríguez Pérez <miguel@det.uvigo.gal>
> Signed-off-by: Wxcafé <wxcafe@wxcafe.net>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-16 8:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 15:56 [PATCH 3/4] cdc_ncm: replace the way cdc_ncm hooks into Wxcafé
2020-07-16 8:19 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).