diff options
author | Shannon Nelson <snelson@pensando.io> | 2019-09-03 15:28:21 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-05 09:24:44 +0200 |
commit | 8c15440bce31afd5eea8c696f31a774bef4e5208 (patch) | |
tree | f49dd747e6fdedbaff440eda4c990d07216d0ff2 /drivers/net/ethernet/pensando/ionic/ionic_lif.h | |
parent | ionic: Add RSS support (diff) | |
download | linux-dev-8c15440bce31afd5eea8c696f31a774bef4e5208.tar.xz linux-dev-8c15440bce31afd5eea8c696f31a774bef4e5208.zip |
ionic: Add coalesce and other features
Interrupt coalescing, tunable copybreak value, and
tx timeout.
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/pensando/ionic/ionic_lif.h')
-rw-r--r-- | drivers/net/ethernet/pensando/ionic/ionic_lif.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.h b/drivers/net/ethernet/pensando/ionic/ionic_lif.h index 2e931a704565..812190e729c2 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.h +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.h @@ -177,6 +177,7 @@ struct ionic_lif { struct dentry *dentry; u32 rx_coalesce_usecs; u32 flags; + struct work_struct tx_timeout_work; }; #define lif_to_txqcq(lif, i) ((lif)->txqcqs[i].qcq) @@ -195,6 +196,35 @@ static inline int ionic_wait_for_bit(struct ionic_lif *lif, int bitname) return test_bit(bitname, lif->state); } +static inline u32 ionic_coal_usec_to_hw(struct ionic *ionic, u32 usecs) +{ + u32 mult = le32_to_cpu(ionic->ident.dev.intr_coal_mult); + u32 div = le32_to_cpu(ionic->ident.dev.intr_coal_div); + + /* Div-by-zero should never be an issue, but check anyway */ + if (!div || !mult) + return 0; + + /* Round up in case usecs is close to the next hw unit */ + usecs += (div / mult) >> 1; + + /* Convert from usecs to device units */ + return (usecs * mult) / div; +} + +static inline u32 ionic_coal_hw_to_usec(struct ionic *ionic, u32 units) +{ + u32 mult = le32_to_cpu(ionic->ident.dev.intr_coal_mult); + u32 div = le32_to_cpu(ionic->ident.dev.intr_coal_div); + + /* Div-by-zero should never be an issue, but check anyway */ + if (!div || !mult) + return 0; + + /* Convert from device units to usec */ + return (units * div) / mult; +} + int ionic_lifs_alloc(struct ionic *ionic); void ionic_lifs_free(struct ionic *ionic); void ionic_lifs_deinit(struct ionic *ionic); |