tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: if_txtimer API to replace (*if_watchdog)()



> On Jan 24, 2020, at 6:57 AM, Jason Thorpe <thorpej%me.com@localhost> wrote:
> 
> No, they're not disparate usage models at all, because you'll notice that the way those drivers use if_txtimer_arm() and if_txtimer_disarm() are equivalent.
> 
> The difference is really one just of setup.

While driving into work, I thought of something else I wanted to say about this...

You're saying "two disparate usage models" ... but I see it very differently.

I see this as "an API that a simple way of using it that satisfies a lot of usage scenarios, and a more complicated way of using it for applications that want a little more control and/or flexibility, or who wish to optimize".

The simpler model is to use if_txtimer_alloc_with_callback() (i.e. what we've been referring to as "if_txtimer_callout" in this thread).  This model is the "Hey, we set things up to handle a single transmit queue and do a bunch of the work for you, all you need to do is tell us what function to call when we detect that the timer has expired, and when you bring the interface up and down."

The more complicated model is to use if_txtimer_alloc().  This model is the "Hey, I understand you have a more complex driver there.  Here's a way to use this facility cheaply within the structure you already have."

There is nothing preventing the simpler variant from being used everywhere, but the more complicated variant (which isn't really that much more complicated) allows for a bit less overhead when the driver is already doing some of necessary work.

That's really the gist of it.

-- thorpej



Home | Main Index | Thread Index | Old Index