Skip to contentSkip to conversation

igb: report unsupported ethtool settings in set_coalesce

PATCH Superseded Todd Fujinaka 5 participants 6 messages May 22, 2015 – Jun 3, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 igb: report unsupported ethtool settings in set_coalesce

There are many settings possible using ethtool -C/--coalesce, but not all of them are supported. Report failure when an unsupported option is set.

---
 drivers/net/ethernet/intel/igb/igb_ethtool.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +21 -0
index 109cad9..13560fe 100644
@@ -2159,6 +2159,27 @@ static int igb_set_coalesce(struct net_device *netdev,
 	struct igb_adapter *adapter = netdev_priv(netdev);
 	int i;
 
+	if ((ec->rx_max_coalesced_frames != -1) ||
+	    (ec->rx_coalesce_usecs_irq != -1) ||
+	    (ec->rx_max_coalesced_frames_irq != -1) ||
+	    (ec->tx_max_coalesced_frames != -1) ||
+	    (ec->tx_coalesce_usecs_irq != -1) ||
+	    (ec->stats_block_coalesce_usecs != -1) ||
+	    (ec->use_adaptive_rx_coalesce != -1) ||
+	    (ec->use_adaptive_tx_coalesce != -1) ||
+	    (ec->pkt_rate_low != -1) ||
+	    (ec->rx_coalesce_usecs_low != -1) ||
+	    (ec->rx_max_coalesced_frames_low != -1) ||
+	    (ec->tx_coalesce_usecs_low != -1) ||
+	    (ec->tx_max_coalesced_frames_low != -1) ||
+	    (ec->pkt_rate_high != -1) ||
+	    (ec->rx_coalesce_usecs_high != -1) ||
+	    (ec->rx_max_coalesced_frames_high != -1) ||
+	    (ec->tx_coalesce_usecs_high != -1) ||
+	    (ec->tx_max_coalesced_frames_high != -1) ||
+	    (ec->rate_sample_interval != -1))
+		return -ENOTSUPP;
+
 	if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
 	    ((ec->rx_coalesce_usecs > 3) &&
 	     (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||
#1 lore raw

PATCH 1/1 igb: report unsupported ethtool settings in set_coalesce

Quoted 32 lines · Todd Fujinaka

There are many settings possible using ethtool -C/--coalesce, but not all of them are supported. Report failure when an unsupported option is set.

---
  drivers/net/ethernet/intel/igb/igb_ethtool.c |   21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +14 -0
index 109cad9..13560fe 100644
@@ -2159,6 +2159,27 @@ static int igb_set_coalesce(struct net_device *netdev,
  	struct igb_adapter *adapter = netdev_priv(netdev);
  	int i;
 
+	if ((ec->rx_max_coalesced_frames != -1) ||
+	    (ec->rx_coalesce_usecs_irq != -1) ||
+	    (ec->rx_max_coalesced_frames_irq != -1) ||
+	    (ec->tx_max_coalesced_frames != -1) ||
+	    (ec->tx_coalesce_usecs_irq != -1) ||
+	    (ec->stats_block_coalesce_usecs != -1) ||
+	    (ec->use_adaptive_rx_coalesce != -1) ||
+	    (ec->use_adaptive_tx_coalesce != -1) ||
+	    (ec->pkt_rate_low != -1) ||
+	    (ec->rx_coalesce_usecs_low != -1) ||
+	    (ec->rx_max_coalesced_frames_low != -1) ||
+	    (ec->tx_coalesce_usecs_low != -1) ||
+	    (ec->tx_max_coalesced_frames_low != -1) ||
+	    (ec->pkt_rate_high != -1) ||

drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_coalesce(struct net_device *netdev, · line 2185

Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +7 -0
+	    (ec->rx_coalesce_usecs_high != -1) ||
+	    (ec->rx_max_coalesced_frames_high != -1) ||
+	    (ec->tx_coalesce_usecs_high != -1) ||
+	    (ec->tx_max_coalesced_frames_high != -1) ||
+	    (ec->rate_sample_interval != -1))
+		return -ENOTSUPP;
+
  	if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
  	    ((ec->rx_coalesce_usecs > 3) &&
  	     (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||

Shouldn't these tests all give you a signed/unsigned mismatch since you are comparing an unsigned 32 bit value versus a signed value?

- Alex

#2 lore raw

PATCH 1/1 igb: report unsupported ethtool settings in set_coalesce

Those are unsigned? The code for ethtool set them all to -1.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
todd.fujinaka at intel.com
(503) 712-4565

-----Original Message-----
From: Alexander Duyck [mailto:alexander.h.duyck at redhat.com]
Sent: Friday, May 22, 2015 11:09 AM
To: Fujinaka, Todd; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH] igb: report unsupported ethtool settings in set_coalesce

Quoted 33 lines · Todd Fujinaka

There are many settings possible using ethtool -C/--coalesce, but not all of them are supported. Report failure when an unsupported option is set.

---
  drivers/net/ethernet/intel/igb/igb_ethtool.c |   21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +14 -0
index 109cad9..13560fe 100644
@@ -2159,6 +2159,27 @@ static int igb_set_coalesce(struct net_device *netdev,
  	struct igb_adapter *adapter = netdev_priv(netdev);
  	int i;
 
+	if ((ec->rx_max_coalesced_frames != -1) ||
+	    (ec->rx_coalesce_usecs_irq != -1) ||
+	    (ec->rx_max_coalesced_frames_irq != -1) ||
+	    (ec->tx_max_coalesced_frames != -1) ||
+	    (ec->tx_coalesce_usecs_irq != -1) ||
+	    (ec->stats_block_coalesce_usecs != -1) ||
+	    (ec->use_adaptive_rx_coalesce != -1) ||
+	    (ec->use_adaptive_tx_coalesce != -1) ||
+	    (ec->pkt_rate_low != -1) ||
+	    (ec->rx_coalesce_usecs_low != -1) ||
+	    (ec->rx_max_coalesced_frames_low != -1) ||
+	    (ec->tx_coalesce_usecs_low != -1) ||
+	    (ec->tx_max_coalesced_frames_low != -1) ||
+	    (ec->pkt_rate_high != -1) ||

drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_coalesce(struct net_device *netdev, · line 2185

Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +7 -0
+	    (ec->rx_coalesce_usecs_high != -1) ||
+	    (ec->rx_max_coalesced_frames_high != -1) ||
+	    (ec->tx_coalesce_usecs_high != -1) ||
+	    (ec->tx_max_coalesced_frames_high != -1) ||
+	    (ec->rate_sample_interval != -1))
+		return -ENOTSUPP;
+
  	if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
  	    ((ec->rx_coalesce_usecs > 3) &&
  	     (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||

Shouldn't these tests all give you a signed/unsigned mismatch since you are comparing an unsigned 32 bit value versus a signed value?

- Alex

#3 lore raw

PATCH 1/1 igb: report unsupported ethtool settings in set_coalesce

I think I see what you are talking about. They used s32 in the ethtool do_scoalesce call, and pointed the void pointer wanted_val at it which is how they did the conversion.

You might want to just == ~0 or ~(ec->...) instead to test the values.

- Alex

Quoted 68 lines · Todd

Those are unsigned? The code for ethtool set them all to -1.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
todd.fujinaka at intel.com
(503) 712-4565

-----Original Message-----
From: Alexander Duyck [mailto:alexander.h.duyck at redhat.com]
Sent: Friday, May 22, 2015 11:09 AM
To: Fujinaka, Todd; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH] igb: report unsupported ethtool settings in set_coalesce

Quoted 33 lines · Todd Fujinaka

There are many settings possible using ethtool -C/--coalesce, but not all of them are supported. Report failure when an unsupported option is set.

---
   drivers/net/ethernet/intel/igb/igb_ethtool.c |   21 +++++++++++++++++++++
   1 file changed, 21 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +14 -0
index 109cad9..13560fe 100644
@@ -2159,6 +2159,27 @@ static int igb_set_coalesce(struct net_device *netdev,
   	struct igb_adapter *adapter = netdev_priv(netdev);
   	int i;
 
+	if ((ec->rx_max_coalesced_frames != -1) ||
+	    (ec->rx_coalesce_usecs_irq != -1) ||
+	    (ec->rx_max_coalesced_frames_irq != -1) ||
+	    (ec->tx_max_coalesced_frames != -1) ||
+	    (ec->tx_coalesce_usecs_irq != -1) ||
+	    (ec->stats_block_coalesce_usecs != -1) ||
+	    (ec->use_adaptive_rx_coalesce != -1) ||
+	    (ec->use_adaptive_tx_coalesce != -1) ||
+	    (ec->pkt_rate_low != -1) ||
+	    (ec->rx_coalesce_usecs_low != -1) ||
+	    (ec->rx_max_coalesced_frames_low != -1) ||
+	    (ec->tx_coalesce_usecs_low != -1) ||
+	    (ec->tx_max_coalesced_frames_low != -1) ||
+	    (ec->pkt_rate_high != -1) ||

drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_coalesce(struct net_device *netdev, · line 2185

Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +7 -0
+	    (ec->rx_coalesce_usecs_high != -1) ||
+	    (ec->rx_max_coalesced_frames_high != -1) ||
+	    (ec->tx_coalesce_usecs_high != -1) ||
+	    (ec->tx_max_coalesced_frames_high != -1) ||
+	    (ec->rate_sample_interval != -1))
+		return -ENOTSUPP;
+
   	if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
   	    ((ec->rx_coalesce_usecs > 3) &&
   	     (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||

Shouldn't these tests all give you a signed/unsigned mismatch since you are comparing an unsigned 32 bit value versus a signed value?

- Alex
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#4 lore raw

PATCH 1/1 igb: report unsupported ethtool settings in set_coalesce

This doesn't appear to work quite right. Jeff, can you pop this? I've redone it.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
todd.fujinaka at intel.com
(503) 712-4565

-----Original Message-----
From: Alexander Duyck [mailto:alexander.duyck at gmail.com]
Sent: Friday, May 22, 2015 11:29 AM
To: Fujinaka, Todd; Alexander Duyck; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH] igb: report unsupported ethtool settings in set_coalesce

I think I see what you are talking about. They used s32 in the ethtool do_scoalesce call, and pointed the void pointer wanted_val at it which is how they did the conversion.

You might want to just == ~0 or ~(ec->...) instead to test the values.

- Alex

Quoted 69 lines · Todd

Those are unsigned? The code for ethtool set them all to -1.

Todd Fujinaka
Software Application Engineer
Networking Division (ND)
Intel Corporation
todd.fujinaka at intel.com
(503) 712-4565

-----Original Message-----
From: Alexander Duyck [mailto:alexander.h.duyck at redhat.com]
Sent: Friday, May 22, 2015 11:09 AM
To: Fujinaka, Todd; intel-wired-lan at lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH] igb: report unsupported ethtool settings in set_coalesce

Quoted 33 lines · Todd Fujinaka

There are many settings possible using ethtool -C/--coalesce, but not all of them are supported. Report failure when an unsupported option is set.

---
   drivers/net/ethernet/intel/igb/igb_ethtool.c |   21 +++++++++++++++++++++
   1 file changed, 21 insertions(+)
drivers/net/ethernet/intel/igb/igb_ethtool.c +14 -0
index 109cad9..13560fe 100644
@@ -2159,6 +2159,27 @@ static int igb_set_coalesce(struct net_device *netdev,
   	struct igb_adapter *adapter = netdev_priv(netdev);
   	int i;
 
+	if ((ec->rx_max_coalesced_frames != -1) ||
+	    (ec->rx_coalesce_usecs_irq != -1) ||
+	    (ec->rx_max_coalesced_frames_irq != -1) ||
+	    (ec->tx_max_coalesced_frames != -1) ||
+	    (ec->tx_coalesce_usecs_irq != -1) ||
+	    (ec->stats_block_coalesce_usecs != -1) ||
+	    (ec->use_adaptive_rx_coalesce != -1) ||
+	    (ec->use_adaptive_tx_coalesce != -1) ||
+	    (ec->pkt_rate_low != -1) ||
+	    (ec->rx_coalesce_usecs_low != -1) ||
+	    (ec->rx_max_coalesced_frames_low != -1) ||
+	    (ec->tx_coalesce_usecs_low != -1) ||
+	    (ec->tx_max_coalesced_frames_low != -1) ||
+	    (ec->pkt_rate_high != -1) ||

drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_coalesce(struct net_device *netdev, · line 2185

Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +7 -0
+	    (ec->rx_coalesce_usecs_high != -1) ||
+	    (ec->rx_max_coalesced_frames_high != -1) ||
+	    (ec->tx_coalesce_usecs_high != -1) ||
+	    (ec->tx_max_coalesced_frames_high != -1) ||
+	    (ec->rate_sample_interval != -1))
+		return -ENOTSUPP;
+
   	if ((ec->rx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
   	    ((ec->rx_coalesce_usecs > 3) &&
   	     (ec->rx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||

Shouldn't these tests all give you a signed/unsigned mismatch since you are comparing an unsigned 32 bit value versus a signed value?

- Alex
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan at lists.osuosl.org
http://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#5 lore raw

PATCH 1/1 igb: report unsupported ethtool settings in set_coalesce

Quoted 2 lines · Todd

This doesn't appear to work quite right. Jeff, can you pop this? I've redone it.

I have removed it from my queue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20150603/d0ad968d/attachment-0001.asc>