From: Oliver Neukum <oneukum@suse.com>
To: "Miguel Rodríguez Pérez" <miguel@det.uvigo.gal>,
gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH v3 1/4] Simplify usbnet_cdc_update_filter
Date: Mon, 02 Jul 2018 10:25:44 +0200 [thread overview]
Message-ID: <1530519944.18402.10.camel@suse.com> (raw)
In-Reply-To: <20180701090553.7776-2-miguel@det.uvigo.gal>
On So, 2018-07-01 at 11:05 +0200, Miguel Rodríguez Pérez wrote:
> Remove some unneded varibles to make the code easier to read
> and, replace the generic usb_control_msg function for the
> more specific usbnet_write_cmd.
>
> Signed-off-by: Miguel Rodríguez Pérez <miguel@det.uvigo.gal>
No,
sorry, but this is not good. The reason is a bit subtle.
Drivers need to reset the filters when handling post_reset()
[ and reset_resume() ] usbnet_write_cmd() falls back to
kmemdup() with GFP_KERNEL. Usbnet is a framework with class
drivers and some of the devices we drive have a storage
interface. Thence we are on the block error handling path here.
The simplest solution is to leave out this patch in the sequence.
Regards
Oliver
NACKED-BY: Oliver Neukum <oneukum@suse.com>
> ---
> drivers/net/usb/cdc_ether.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
> index 178b956501a7..815ed0dc18fe 100644
> --- a/drivers/net/usb/cdc_ether.c
> +++ b/drivers/net/usb/cdc_ether.c
> @@ -77,9 +77,7 @@ static const u8 mbm_guid[16] = {
>
> static void usbnet_cdc_update_filter(struct usbnet *dev)
> {
> - struct cdc_state *info = (void *) &dev->data;
> - struct usb_interface *intf = info->control;
> - struct net_device *net = dev->net;
> + struct net_device *net = dev->net;
>
> u16 cdc_filter = USB_CDC_PACKET_TYPE_DIRECTED
> | USB_CDC_PACKET_TYPE_BROADCAST;
> @@ -93,16 +91,13 @@ static void usbnet_cdc_update_filter(struct usbnet *dev)
> if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI))
> cdc_filter |= USB_CDC_PACKET_TYPE_ALL_MULTICAST;
>
> - usb_control_msg(dev->udev,
> - usb_sndctrlpipe(dev->udev, 0),
> + usbnet_write_cmd(dev,
> USB_CDC_SET_ETHERNET_PACKET_FILTER,
> - USB_TYPE_CLASS | USB_RECIP_INTERFACE,
> + USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE,
> cdc_filter,
> - intf->cur_altsetting->desc.bInterfaceNumber,
> + dev->intf->cur_altsetting->desc.bInterfaceNumber,
> NULL,
> - 0,
> - USB_CTRL_SET_TIMEOUT
> - );
> + 0);
> }
>
> /* probes control interface, claims data interface, collects the bulk
next prev parent reply other threads:[~2018-07-02 8:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 17:32 [PATCH v2 1/4] Simplify usbnet_cdc_update_filter Miguel Rodríguez Pérez
2018-07-01 8:15 ` Greg KH
2018-07-01 9:05 ` [PATCH v3 0/4] usbnet: Admit multicast traffic in cdc ncm devices Miguel Rodríguez Pérez
2018-07-01 9:05 ` [PATCH v3 1/4] Simplify usbnet_cdc_update_filter Miguel Rodríguez Pérez
2018-07-02 8:25 ` Oliver Neukum [this message]
2018-07-02 11:19 ` Miguel Rodríguez Pérez
2018-07-02 11:28 ` [PATCH v4 1/4] Use dev->intf to get interface information Miguel Rodríguez Pérez
2018-07-02 17:13 ` [PATCH v3 1/4] Simplify usbnet_cdc_update_filter Bjørn Mork
2020-07-13 20:43 ` Wxcafé
2020-07-14 6:06 ` Greg KH
2020-07-14 15:13 ` Wxcafé
2020-07-14 16:13 ` Greg KH
2018-07-01 9:05 ` [PATCH v3 2/4] Export usbnet_cdc_update_filter Miguel Rodríguez Pérez
2018-07-02 8:26 ` Oliver Neukum
2018-07-01 9:05 ` [PATCH v3 3/4] Replace the way cdc_ncm hooks into usbnet_change_mtu Miguel Rodríguez Pérez
2018-07-04 14:32 ` [PATCH v4 3/4] Add .ndo_set_rx_mode to cdc_ncm_netdev_ops Miguel Rodríguez Pérez
2018-07-04 14:41 ` Miguel Rodríguez Pérez
2018-07-01 9:05 ` [PATCH v3 4/4] Hook into set_rx_mode to admit multicast traffic Miguel Rodríguez Pérez
2018-07-09 9:34 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1530519944.18402.10.camel@suse.com \
--to=oneukum@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=miguel@det.uvigo.gal \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).