All of lore.kernel.org
 help / color / mirror / Atom feed
* NCM driver improvments
@ 2011-04-11 11:42 Indrek Peri
  0 siblings, 0 replies; only message in thread
From: Indrek Peri @ 2011-04-11 11:42 UTC (permalink / raw)
  To: alexey.orishko, netdev@vger.kernel.org

Hi all

I have some ideas what could improve NCM driver. This is just for
open discussion. 

* Timer

Current NCM driver introduces timer for sending collected packets.
Driver keeps track of actual point of sending with member tx_timer_pending
which is a counter. This counter is decreased in timeout function and
timer is restarted if counter is bigger than 0. So, currently timeouts
are static.

One idea would be to reduce of amount of timeouts in system to replace
tx_timer_pending counter with varing timer divider. For example, divider
can be from 100 to 1000 (in scales).

 ctx->tx_timer.expires = jiffies + ((HZ + 999) / tmr_divider);

Scale can be calculated form packets and their data sizes collected.
For example, if there is only one TCP download session then TX collects
many small ACKs into buffer. In this case, for example, tmr_divider is 
100 and when timer expires packets will be send out. This avoids system
timeouts.

Another idea is to try to remove timer at all if traffic is low. Every
packet will be send over in one NCM frame. This reduces RTT time for
packet.


* Locks in timeout
        
        spin_lock(&ctx->mtx);
        if (ctx->tx_timer_pending != 0) {
                ctx->tx_timer_pending--;
                restart = 1;
        } else {
                restart = 0;
        }
        spin_unlock(&ctx->mtx);

        if (restart) {
                spin_lock(&ctx->mtx);
                cdc_ncm_tx_timeout_start(ctx);
                spin_unlock(&ctx->mtx);
        } else if (ctx->netdev != NULL) {
                usbnet_start_xmit(NULL, ctx->netdev);
        }

Timer divider would reduce locking because cdc_ncm_fill_tx_frame
function keeps the lock until to the end of function.
Timeout would mean then call to send.

* reset_resume

In cdc_ncm_driver struct is function:

        .reset_resume = usbnet_resume,

I think that this is good to add.

* usbnet_tx_timeout

I have seen slow path warnings in kernel and call to usbnet_tx_timeout 
with NCM driver. There is FIXME in usbnet and may be there is a need for 
reset function inside NCM because NCM driver collects data? 

BR, Indrek Peri

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-11 11:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-11 11:42 NCM driver improvments Indrek Peri

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.