Remove rx_copybreak module param, use ethtool to change its value
Subsystems (5)
cover Remove rx_copybreak module param, use ethtool to change its value
Recently rx_copybreak support for ethtool has been added in
commit: f0db9b073415848709dd59a6394969882f517da9
ethtool: Add generic options for tunables
we can use ethtool to change the rx_copybreak value.
This series removes the rx_copybreak module param and adds ethtool support for the same.
I could only compile test the changes. I do not have the hardware.
Govindarajulu Varadarajan (3):
typhoon: use ethtool for changing rx_copybreak
pcnet32: use ethtool for changing rx_copybreak
sis190: use ethtool for changing rx_copybreak
drivers/net/ethernet/3com/typhoon.c | 49 ++++++++++++++++++++++++++++++++----- drivers/net/ethernet/amd/pcnet32.c | 49 +++++++++++++++++++++++++++++++++---- drivers/net/ethernet/sis/sis190.c | 47 ++++++++++++++++++++++++++++++++--- 3 files changed, 130 insertions(+), 15 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/3 typhoon: use ethtool for changing rx_copybreak
This patch removes the module parameter rx_copybreak. Add new ethtool tunable support for setting/getting rx_copybreak.
--- drivers/net/ethernet/3com/typhoon.c | 49 ++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-)
drivers/net/ethernet/3com/typhoon.c +43 -6
@@ -44,7 +44,7 @@/* Set the copy breakpoint for the copy-only-tiny-frames scheme. * Setting to > 1518 effectively disables this feature. */ -static int rx_copybreak =200 ; +#define TYPHOON_RX_COPYBREAK_DEFAULT 200/* Should we use MMIO or Port IO? * 0: Port IO
@@ -131,12 +131,8 @@ MODULE_VERSION("1.0");MODULE_LICENSE ("GPL" );MODULE_FIRMWARE (FIRMWARE_NAME );MODULE_DESCRIPTION ("3Com Typhoon Family (3C990, 3CR990, and variants)" ); -MODULE_PARM_DESC (rx_copybreak,"Packets smaller than this are copied and " -"the buffer given back to the NIC. Default " -"is 200." );MODULE_PARM_DESC (use_mmio,"Use MMIO (1) or PIO(0) to access the NIC. " "Default is to try MMIO and fallback to PIO." ); -module_param (rx_copybreak, int,0 );module_param (use_mmio, int,0 );#if defined(NETIF_F_TSO ) &&MAX_SKB_FRAGS >32
@@ -294,6 +290,7 @@ struct typhoon {/* unused stuff (future use) */ int capabilities;struct transmit_ring txHiRing; +u32 rx_copybreak; };enum completion_wait_values {
@@ -1144,6 +1141,43 @@ typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) ering->tx_pending =TXLO_ENTRIES -1 ; } +static int typhoon_get_tunable (struct net_device *dev, +const struct ethtool_tunable *tuna,void *data) +{ +struct typhoon *tp =netdev_priv (dev); +int ret =0 ; + +switch (tuna->id) { +case ETHTOOL_RX_COPYBREAK : + *(u32 *)data = tp->rx_copybreak; +break ; +default : + ret = -EINVAL ; +break ; + } + +return ret; +} + +static int typhoon_set_tunable (struct net_device *dev, +const struct ethtool_tunable *tuna, +const void *data) +{ +struct typhoon *tp =netdev_priv (dev); +int ret =0 ; + +switch (tuna->id) { +case ETHTOOL_RX_COPYBREAK : + tp->rx_copybreak = *(u32 *)data; +break ; +default : + ret = -EINVAL ; +break ; + } + +return ret; +} +static const struct ethtool_ops typhoon_ethtool_ops = { .get_settings = typhoon_get_settings, .set_settings = typhoon_set_settings,
@@ -1152,6 +1186,8 @@ static const struct ethtool_ops typhoon_ethtool_ops = { .set_wol = typhoon_set_wol, .get_link = ethtool_op_get_link, .get_ringparam = typhoon_get_ringparam, + .get_tunable = typhoon_get_tunable, + .set_tunable = typhoon_set_tunable, }; static int
@@ -1659,7 +1695,7 @@ typhoon_rx(struct typhoon *tp, struct basic_ring *rxRing, volatile __le32 * read pkt_len =le16_to_cpu (rx->frameLen); -if (pkt_len < rx_copybreak && +if (pkt_len < tp->rx_copybreak && (new_skb =netdev_alloc_skb (tp->dev, pkt_len +2 )) !=NULL ) {skb_reserve (new_skb,2 ); pci_dma_sync_single_for_cpu(tp->pdev, dma_addr,
@@ -2358,6 +2394,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) tp->ioaddr = ioaddr; tp->tx_ioaddr = ioaddr; tp->dev = dev; + tp->rx_copybreak =TYPHOON_RX_COPYBREAK_DEFAULT ;/* Init sequence: * 1) Reset the adapter to clear any bad juju
Signature · 1 line
2.1.0
PATCH 2/3 pcnet32: use ethtool for changing rx_copybreak
In reply to Govindarajulu VaradarajanThis patch removes the module parameter rx_copybreak. Add new ethtool tunable support for setting/getting rx_copybreak.
--- drivers/net/ethernet/amd/pcnet32.c | 49 ++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-)
drivers/net/ethernet/amd/pcnet32.c +44 -5
@@ -92,7 +92,7 @@ static int pcnet32vlb; /* check for VLB cards ? */static struct net_device *pcnet32_dev;static int max_interrupt_work =2 ; -static int rx_copybreak =200 ; +#define PCNET_RX_COPYBREAK_DEFAULT 200#define PCNET32_PORT_AUI 0x00#define PCNET32_PORT_10BT 0x01
@@ -303,6 +303,7 @@ struct pcnet32_private {/* saved registers during ethtool blink */ u16 save_regs[4 ]; +u32 rx_copybreak; };static int pcnet32_probe_pci (struct pci_dev *,const struct pci_device_id *);
@@ -1155,7 +1156,7 @@ static void pcnet32_rx_entry(struct net_device *dev,return ; } -if (pkt_len > rx_copybreak) { +if (pkt_len > lp->rx_copybreak) {struct sk_buff *newskb;dma_addr_t new_dma_addr;
@@ -1439,6 +1440,43 @@ static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,spin_unlock_irqrestore (&lp->lock, flags); } +static int pcnet32_get_tunable (struct net_device *dev, +const struct ethtool_tunable *tuna,void *data) +{ +struct pcnet32_private *lp =netdev_priv (dev); +int ret =0 ; + +switch (tuna->id) { +case ETHTOOL_RX_COPYBREAK : + *(u32 *)data = lp->rx_copybreak; +break ; +default : + ret = -EINVAL ; +break ; + } + +return ret; +} + +static int pcnet32_set_tunable (struct net_device *dev, +const struct ethtool_tunable *tuna, +const void *data) +{ +struct pcnet32_private *lp =netdev_priv (dev); +int ret =0 ; + +switch (tuna->id) { +case ETHTOOL_RX_COPYBREAK : + lp->rx_copybreak = *(u32 *)data; +break ; +default : + ret = -EINVAL ; +break ; + } + +return ret; +} +static const struct ethtool_ops pcnet32_ethtool_ops = { .get_settings = pcnet32_get_settings, .set_settings = pcnet32_set_settings,
@@ -1455,6 +1493,8 @@ static const struct ethtool_ops pcnet32_ethtool_ops = { .get_regs_len = pcnet32_get_regs_len, .get_regs = pcnet32_get_regs, .get_sset_count = pcnet32_get_sset_count, + .get_tunable = pcnet32_get_tunable, + .set_tunable = pcnet32_set_tunable, };/* only probes for non-PCI devices, the rest are handled by
@@ -1912,6 +1952,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)/* enable LED writes */ a->write_bcr (ioaddr,2 , a->read_bcr (ioaddr,2 ) |0x1000 ); + lp->rx_copybreak =PCNET_RX_COPYBREAK_DEFAULT ; +return 0 ; err_free_ring:
@@ -2885,9 +2927,6 @@ MODULE_PARM_DESC(debug, DRV_NAME " debug level");module_param (max_interrupt_work, int,0 );MODULE_PARM_DESC (max_interrupt_work,DRV_NAME " maximum events handled per interrupt" ); -module_param (rx_copybreak, int,0 ); -MODULE_PARM_DESC (rx_copybreak, -DRV_NAME " copy breakpoint for copy-only-tiny-frames" );module_param (tx_start_pt, int,0 );MODULE_PARM_DESC (tx_start_pt,DRV_NAME " transmit start point (0-3)" );module_param (pcnet32vlb, int,0 );
Signature · 1 line
2.1.0
PATCH 3/3 sis190: use ethtool for changing rx_copybreak
In reply to Govindarajulu VaradarajanThis patch removes the module parameter rx_copybreak. Add new ethtool tunable support for setting/getting rx_copybreak.
--- drivers/net/ethernet/sis/sis190.c | 47 +++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-)
drivers/net/ethernet/sis/sis190.c +43 -4
@@ -290,6 +290,7 @@ struct sis190_private {LNK_ON ,LNK_AUTONEG , } link_status; +u32 rx_copybreak; }; struct sis190_phy {
@@ -338,15 +339,13 @@ static const struct pci_device_id sis190_pci_tbl[] = {MODULE_DEVICE_TABLE (pci, sis190_pci_tbl); -static int rx_copybreak =200 ; +#define SIS190_RX_COPYBREAK_DEFAULT 200static struct {u32 msg_enable; } debug = {-1 };MODULE_DESCRIPTION ("SiS sis190/191 Gigabit Ethernet driver" ); -module_param (rx_copybreak, int,0 ); -MODULE_PARM_DESC (rx_copybreak,"Copy breakpoint for copy-only-tiny-frames" );module_param_named (debug, debug.msg_enable, int,0 );MODULE_PARM_DESC (debug,"Debug verbosity level (0=none, ..., 16=all)" );MODULE_AUTHOR ("K.M. Liu <[email protected]>, Ueimor <[email protected]>" );
@@ -535,7 +534,7 @@ static bool sis190_try_rx_copy(struct sis190_private *tp,struct sk_buff *skb;bool done = false; -if (pkt_size >= rx_copybreak) +if (pkt_size >= tp->rx_copybreak) goto out; skb =netdev_alloc_skb_ip_align (tp->dev, pkt_size);
@@ -1522,6 +1521,7 @@ static struct net_device *sis190_init_board(struct pci_dev *pdev) tp->pci_dev = pdev; tp->mmio_addr = ioaddr; tp->link_status =LNK_OFF ; + tp->rx_copybreak =SIS190_RX_COPYBREAK_DEFAULT ;sis190_irq_mask_and_ack (ioaddr);
@@ -1796,6 +1796,43 @@ static void sis190_set_msglevel(struct net_device *dev, u32 value) tp->msg_enable = value; } +static int sis190_get_tunable (struct net_device *dev, +const struct ethtool_tunable *tuna,void *data) +{ +struct sis190_private *tp =netdev_priv (dev); +int ret =0 ; + +switch (tuna->id) { +case ETHTOOL_RX_COPYBREAK : + *(u32 *)data = tp->rx_copybreak; +break ; +default : + ret = -EINVAL ; +break ; + } + +return ret; +} + +static int sis190_set_tunable (struct net_device *dev, +const struct ethtool_tunable *tuna, +const void *data) +{ +struct sis190_private *tp =netdev_priv (dev); +int ret =0 ; + +switch (tuna->id) { +case ETHTOOL_RX_COPYBREAK : + tp->rx_copybreak = *(u32 *)data; +break ; +default : + ret = -EINVAL ; +break ; + } + +return ret; +} +static const struct ethtool_ops sis190_ethtool_ops = { .get_settings = sis190_get_settings, .set_settings = sis190_set_settings,
@@ -1806,6 +1843,8 @@ static const struct ethtool_ops sis190_ethtool_ops = { .get_msglevel = sis190_get_msglevel, .set_msglevel = sis190_set_msglevel, .nway_reset = sis190_nway_reset, + .get_tunable = sis190_get_tunable, + .set_tunable = sis190_set_tunable, };static int sis190_ioctl (struct net_device *dev,struct ifreq *ifr,int cmd)
Signature · 1 line
2.1.0
David Miller
maintainerFrom: Govindarajulu Varadarajan <[email protected]>
Date: Wed, 17 Sep 2014 02:21:24 +0530
Quoted 2 lines
This series removes the
rx_copybreakmodule param and adds ethtool support for the same.
Module parameters are an interface visible to the user and cannot just be removed.
Sorry.