public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum-l3A5Bk7waGM@public•gmane.org>
To: "Bjørn Mork" <bjorn-yOkvZcmFvRU@public•gmane.org>
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
Subject: Re: [RFC] net: usbnet: prevent buggy devices from killing us
Date: Thu, 24 Jan 2013 14:12 +0100	[thread overview]
Message-ID: <2556579.vjYlY1iKn5@linux-5eaq.site> (raw)
In-Reply-To: <87y5fig32r.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>

On Thursday 24 January 2013 13:47:40 Bjørn Mork wrote:
> Oliver Neukum <oneukum-l3A5Bk7waGM@public•gmane.org> writes:
> > On Thursday 24 January 2013 12:22:54 Bjørn Mork wrote:
> >
> >> Sorry for being daft, but how do I code the "20 among the last 30" part
> >> there?
> >
> > Just by agreeing that you can live with false negatives but not false positives
> >
> > if (++counter > 30) {
> > 	counter = bogus = 0;
> > } else {
> > 	if (is_bogus(packet)
> > 		bogus++;
> > 	if (bogus > counter/2)

Should probably be something like bogus > counter/2 + 10

> > 		throttle();
> > }
> 
> So, add two new counters to struct usbnet for this?  That seems a little
> overkill to me, but I don't see how else to implement anything like that.

Memory is cheap.
 
> It is still not completely clear to me how the throttling/unthrottling
> should be done.  It tested with static counters (to avoid having to
> rebuild everything for this test) and a new EVENT_RX_THROTTLE flag.
> Still on top of my previous patch just for safety while testing, as I am
> fed up of having to reboot all the time :-)
> 
> Doing the flag test in rx_submit seems simpler than trying to track all
> the places this is called.  Still checking the dev->done.qlen to be able
> to unthrottle.

Ideally we would do some error handling. Does the device keep spewing
zero packets for all eternity?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-01-24 13:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 10:25 [RFC] net: usbnet: prevent buggy devices from killing us Bjørn Mork
     [not found] ` <1359023152-32576-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-01-24 10:46   ` Oliver Neukum
     [not found]     ` <6505263.QGCG9bfoCC-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-01-24 10:52       ` Bjørn Mork
     [not found]         ` <87bocehmzd.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2013-01-24 11:03           ` Oliver Neukum
     [not found]             ` <2321910.EQLkSoxl50-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-01-24 11:22               ` Bjørn Mork
     [not found]                 ` <877gn2hlkh.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2013-01-24 11:31                   ` Oliver Neukum
2013-01-24 12:47                     ` Bjørn Mork
     [not found]                       ` <87y5fig32r.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2013-01-24 13:12                         ` Oliver Neukum [this message]
     [not found]                           ` <2556579.vjYlY1iKn5-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-01-24 13:42                             ` Bjørn Mork
2013-01-24 19:16                             ` [PATCH net] " Bjørn Mork
2013-01-24 22:09                               ` Oliver Neukum
2013-01-25  7:13                                 ` Bjørn Mork
2013-01-25 12:02                                   ` Oliver Neukum
     [not found]                                     ` <1659086.jLlTU1VIap-7ztolUikljGernLeA6q8OA@public.gmane.org>
2013-01-25 12:27                                       ` Bjørn Mork
     [not found]                               ` <1359055016-13603-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-01-24 23:57                                 ` Joe Perches
2013-01-25  8:14                                   ` Bjørn Mork
2013-01-24 10:47 ` [RFC] " Bjørn Mork
2013-01-24 12:39 ` Sergei Shtylyov
     [not found]   ` <51012B76.1060600-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
2013-01-24 13:01     ` Joe Perches

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=2556579.vjYlY1iKn5@linux-5eaq.site \
    --to=oneukum-l3a5bk7wagm@public$(echo .)gmane.org \
    --cc=bjorn-yOkvZcmFvRU@public$(echo .)gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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