Commit c8e9b92d authored by Kevin Wern's avatar Kevin Wern Committed by Greg Kroah-Hartman

staging/slicoss: Use ethtool_ops instead of module_param.

ethtool_ops has attributes in sub struct ethtool_coalesce that
correspond to the parameters intagg_delay and dynamic_intagg. It is
preferable to set these properties with ethtool rather than
module_param, so create these attributes in adapter and set them using
ethtool_coalesce's rx_coalesce_usecs and rx_use_adaptive_coalesce.
(Outlined in TODO file)
Signed-off-by: default avatarKevin Wern <kevin.m.wern@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e5349952
...@@ -478,6 +478,8 @@ struct adapter { ...@@ -478,6 +478,8 @@ struct adapter {
u32 max_isr_xmits; u32 max_isr_xmits;
u32 rcv_interrupt_yields; u32 rcv_interrupt_yields;
u32 intagg_period; u32 intagg_period;
u32 intagg_delay;
u32 dynamic_intagg;
struct inicpm_state *inicpm_info; struct inicpm_state *inicpm_info;
void *pinicpm_info; void *pinicpm_info;
struct slic_ifevents if_events; struct slic_ifevents if_events;
......
...@@ -102,8 +102,7 @@ static char *slic_banner = "Alacritech SLIC Technology(tm) Server and Storage Ac ...@@ -102,8 +102,7 @@ static char *slic_banner = "Alacritech SLIC Technology(tm) Server and Storage Ac
static char *slic_proc_version = "2.0.351 2006/07/14 12:26:00"; static char *slic_proc_version = "2.0.351 2006/07/14 12:26:00";
static struct base_driver slic_global = { {}, 0, 0, 0, 1, NULL, NULL }; static struct base_driver slic_global = { {}, 0, 0, 0, 1, NULL, NULL };
static int intagg_delay = 100; #define DEFAULT_INTAGG_DELAY 100
static u32 dynamic_intagg;
static unsigned int rcv_count; static unsigned int rcv_count;
#define DRV_NAME "slicoss" #define DRV_NAME "slicoss"
...@@ -119,17 +118,14 @@ MODULE_AUTHOR(DRV_AUTHOR); ...@@ -119,17 +118,14 @@ MODULE_AUTHOR(DRV_AUTHOR);
MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
module_param(dynamic_intagg, int, 0);
MODULE_PARM_DESC(dynamic_intagg, "Dynamic Interrupt Aggregation Setting");
module_param(intagg_delay, int, 0);
MODULE_PARM_DESC(intagg_delay, "uSec Interrupt Aggregation Delay");
static const struct pci_device_id slic_pci_tbl[] = { static const struct pci_device_id slic_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_ALACRITECH, SLIC_1GB_DEVICE_ID) }, { PCI_DEVICE(PCI_VENDOR_ID_ALACRITECH, SLIC_1GB_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_ALACRITECH, SLIC_2GB_DEVICE_ID) }, { PCI_DEVICE(PCI_VENDOR_ID_ALACRITECH, SLIC_2GB_DEVICE_ID) },
{ 0 } { 0 }
}; };
static struct ethtool_ops slic_ethtool_ops;
MODULE_DEVICE_TABLE(pci, slic_pci_tbl); MODULE_DEVICE_TABLE(pci, slic_pci_tbl);
static inline void slic_reg32_write(void __iomem *reg, u32 value, bool flush) static inline void slic_reg32_write(void __iomem *reg, u32 value, bool flush)
...@@ -2860,7 +2856,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) ...@@ -2860,7 +2856,7 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
if (slic_global.dynamic_intagg) if (slic_global.dynamic_intagg)
slic_intagg_set(adapter, 0); slic_intagg_set(adapter, 0);
else else
slic_intagg_set(adapter, intagg_delay); slic_intagg_set(adapter, adapter->intagg_delay);
/* /*
* Initialize ping status to "ok" * Initialize ping status to "ok"
...@@ -2881,6 +2877,26 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter) ...@@ -2881,6 +2877,26 @@ static int slic_card_init(struct sliccard *card, struct adapter *adapter)
return status; return status;
} }
static int slic_get_coalesce(struct net_device *dev,
struct ethtool_coalesce *coalesce)
{
struct adapter *adapter = netdev_priv(dev);
adapter->intagg_delay = coalesce->rx_coalesce_usecs;
adapter->dynamic_intagg = coalesce->use_adaptive_rx_coalesce;
return 0;
}
static int slic_set_coalesce(struct net_device *dev,
struct ethtool_coalesce *coalesce)
{
struct adapter *adapter = netdev_priv(dev);
coalesce->rx_coalesce_usecs = adapter->intagg_delay;
coalesce->use_adaptive_rx_coalesce = adapter->dynamic_intagg;
return 0;
}
static void slic_init_driver(void) static void slic_init_driver(void)
{ {
if (slic_first_init) { if (slic_first_init) {
...@@ -3069,8 +3085,6 @@ static int slic_entry_probe(struct pci_dev *pcidev, ...@@ -3069,8 +3085,6 @@ static int slic_entry_probe(struct pci_dev *pcidev,
struct sliccard *card = NULL; struct sliccard *card = NULL;
int pci_using_dac = 0; int pci_using_dac = 0;
slic_global.dynamic_intagg = dynamic_intagg;
err = pci_enable_device(pcidev); err = pci_enable_device(pcidev);
if (err) if (err)
...@@ -3112,12 +3126,14 @@ static int slic_entry_probe(struct pci_dev *pcidev, ...@@ -3112,12 +3126,14 @@ static int slic_entry_probe(struct pci_dev *pcidev,
goto err_out_exit_slic_probe; goto err_out_exit_slic_probe;
} }
netdev->ethtool_ops = &slic_ethtool_ops;
SET_NETDEV_DEV(netdev, &pcidev->dev); SET_NETDEV_DEV(netdev, &pcidev->dev);
pci_set_drvdata(pcidev, netdev); pci_set_drvdata(pcidev, netdev);
adapter = netdev_priv(netdev); adapter = netdev_priv(netdev);
adapter->netdev = netdev; adapter->netdev = netdev;
adapter->pcidev = pcidev; adapter->pcidev = pcidev;
slic_global.dynamic_intagg = adapter->dynamic_intagg;
if (pci_using_dac) if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA; netdev->features |= NETIF_F_HIGHDMA;
...@@ -3204,5 +3220,10 @@ static void __exit slic_module_cleanup(void) ...@@ -3204,5 +3220,10 @@ static void __exit slic_module_cleanup(void)
pci_unregister_driver(&slic_driver); pci_unregister_driver(&slic_driver);
} }
static struct ethtool_ops slic_ethtool_ops = {
.get_coalesce = slic_get_coalesce,
.set_coalesce = slic_set_coalesce
};
module_init(slic_module_init); module_init(slic_module_init);
module_exit(slic_module_cleanup); module_exit(slic_module_cleanup);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment