Skip to contentSkip to conversation

Add ethtool -g support to 8139cp

PATCH Superseded Rick Jones 4 participants 4 messages Oct 5, 2011 – Oct 7, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rick Jones

author
#0 lore raw

PATCH 1/1 Add ethtool -g support to 8139cp

From: Rick Jones <[email protected]>

Add support for reporting ring sizes via ethtool -g to the 8139cp driver.

---

drivers/net/ethernet/realtek/8139cp.c +14 -0
index c77d5af..1dcfe57 100644
@@ -1324,6 +1324,19 @@ static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info
 	strcpy (info->bus_info, pci_name(cp->pdev));
 }
 
+static void cp_get_ringparam(struct net_device *dev,
+				struct ethtool_ringparam *ring)
+{
+	ring->rx_max_pending = CP_RX_RING_SIZE;
+	ring->tx_max_pending = CP_TX_RING_SIZE;
+	ring->rx_mini_max_pending = 0;
+	ring->rx_jumbo_max_pending = 0;
+	ring->rx_pending = CP_RX_RING_SIZE;
+	ring->tx_pending = CP_TX_RING_SIZE;
+	ring->rx_mini_pending = 0;
+	ring->rx_jumbo_pending = 0;
+}
+
 static int cp_get_regs_len(struct net_device *dev)
 {
 	return CP_REGS_SIZE;
@@ -1525,6 +1538,7 @@ static const struct ethtool_ops cp_ethtool_ops = {
 	.get_eeprom_len		= cp_get_eeprom_len,
 	.get_eeprom		= cp_get_eeprom,
 	.set_eeprom		= cp_set_eeprom,
+	.get_ringparam		= cp_get_ringparam,
 };
 
 static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
#1 lore raw
Quoted 18 lines · Rick Jones

From: Rick Jones <[email protected]>

Add support for reporting ring sizes via ethtool -g to the 8139cp driver.

---

drivers/net/ethernet/realtek/8139cp.c +2 -0
index c77d5af..1dcfe57 100644
@@ -1324,6 +1324,19 @@ static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info
 	strcpy (info->bus_info, pci_name(cp->pdev));
 }
 
+static void cp_get_ringparam(struct net_device *dev,
+				struct ethtool_ringparam *ring)

drivers/net/ethernet/realtek/8139cp.c static void cp_get_drvinfo (struct net_device *dev, struct ethtool_drvinfo *info · line 1338

Quoted 10 lines
drivers/net/ethernet/realtek/8139cp.c +10 -0
+{
+	ring->rx_max_pending = CP_RX_RING_SIZE;
+	ring->tx_max_pending = CP_TX_RING_SIZE;
+	ring->rx_mini_max_pending = 0;
+	ring->rx_jumbo_max_pending = 0;
+	ring->rx_pending = CP_RX_RING_SIZE;
+	ring->tx_pending = CP_TX_RING_SIZE;
+	ring->rx_mini_pending = 0;
+	ring->rx_jumbo_pending = 0;
+}

You generally don't need to set fields to zero in ethtool 'get' operations, as the ethtool core will initialise the entire structure to zero.

Ben.

Quoted 15 lines
drivers/net/ethernet/realtek/8139cp.c +1 -1
 static int cp_get_regs_len(struct net_device *dev)
 {
 	return CP_REGS_SIZE;
@@ -1525,6 +1538,7 @@ static const struct ethtool_ops cp_ethtool_ops = {
 	.get_eeprom_len		= cp_get_eeprom_len,
 	.get_eeprom		= cp_get_eeprom,
 	.set_eeprom		= cp_set_eeprom,
+	.get_ringparam		= cp_get_ringparam,
 };
 
 static int cp_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
maintainer
#2 lore raw

From: Ben Hutchings <[email protected]>
Date: Wed, 05 Oct 2011 19:50:48 +0100

Quoted 3 lines

You generally don't need to set fields to zero in ethtool 'get' operations, as the ethtool core will initialise the entire structure to zero.

Rick, please remove the explicit zero initializations and resubmit, thanks.

#3 lore raw
Quoted 7 lines · David Miller

From: Ben Hutchings<[email protected]>
Date: Wed, 05 Oct 2011 19:50:48 +0100

Quoted 3 lines

You generally don't need to set fields to zero in ethtool 'get' operations, as the ethtool core will initialise the entire structure to zero.

Quoted 6 lines

Rick, please remove the explicit zero initializations and resubmit, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Ben/Dave

Thanks for the feedback. I'll tweak and resend under separate cover.

rick
simply copying what he saw in e1000_get_ringparm :)