Skip to contentSkip to conversation

ixgb: Convert to new vlan model.

PATCH In review Jesse Gross 4 participants 12 messages Dec 14, 2010 – Dec 16, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgb: Convert to new vlan model.

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured.

CC Emil Tantilov <[email protected]>
CC Jeff Kirsher <[email protected]>
CC Alex Duyck <[email protected]>
---
 drivers/net/ixgb/ixgb.h         |    2 +-
 drivers/net/ixgb/ixgb_ethtool.c |   41 +++++++++++++++++++++++++++++
 drivers/net/ixgb/ixgb_main.c    |   54 ++++++++------------------------------
 3 files changed, 54 insertions(+), 43 deletions(-)
drivers/net/ixgb/ixgb.h +1 -1
index 521c0c7..8f3df04 100644
@@ -149,7 +149,7 @@ struct ixgb_desc_ring {
 
 struct ixgb_adapter {
 	struct timer_list watchdog_timer;
-	struct vlan_group *vlgrp;
+	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
 	u32 bd_number;
 	u32 rx_buffer_len;
 	u32 part_num;
drivers/net/ixgb/ixgb_ethtool.c +41 -0

53 lines not on this page · raw message

drivers/net/ixgb/ixgb_main.c +12 -42

107 lines not on this page · raw message

Signature · 1 line
1.7.1
#1 lore raw
Quoted 4 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured.

[...]

Quoted 16 lines
drivers/net/ixgb/ixgb_ethtool.c +8 -0
index 43994c1..0e4c527 100644
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 	}
 }
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data)
+{
+	struct ixgb_adapter *adapter = netdev_priv(netdev);
+	bool need_reset;
+	int rc;
+
+	/* The hardware requires that RX vlan stripping and TX vlan insertion
+	 * be configured together.  Therefore, if one setting changes adjust the

drivers/net/ixgb/ixgb_ethtool.c ixgb_get_strings(struct net_device *netdev, u32 stringset, u8 *data) · line 726

Quoted 10 lines
drivers/net/ixgb/ixgb_ethtool.c +10 -0
+	 * other one to match.
+	 */
+	if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+		if ((data & ETH_FLAG_RXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_RX))
+			data ^= ETH_FLAG_TXVLAN;
+		else if ((data & ETH_FLAG_TXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_TX))
+			data ^= ETH_FLAG_RXVLAN;
+	}

[...]

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#2 lore raw
Quoted 30 lines · Ben Hutchings
Quoted 27 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...]

drivers/net/ixgb/ixgb_ethtool.c +4 -0
index 43994c1..0e4c527 100644
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev, u32
 stringset, u8 *data)  	} }
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data) +{
+	struct ixgb_adapter *adapter = netdev_priv(netdev); +	bool
 need_reset; +	int rc;
+
+	/* The hardware requires that RX vlan stripping and TX vlan

insertion + * be configured together. Therefore, if one setting
changes adjust the + * other one to match. + */

drivers/net/ixgb/ixgb_ethtool.c +8 -0
+	if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+		if ((data & ETH_FLAG_RXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_RX))
+			data ^= ETH_FLAG_TXVLAN;
+		else if ((data & ETH_FLAG_TXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_TX))
+			data ^= ETH_FLAG_RXVLAN;
+	}

[...]

Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Thanks,
Emil

#3 lore raw
Quoted 31 lines · Emil S
Quoted 30 lines · Ben Hutchings
Quoted 27 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...]

drivers/net/ixgb/ixgb_ethtool.c +4 -0
index 43994c1..0e4c527 100644
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev, u32
 stringset, u8 *data)  	} }
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data) +{
+	struct ixgb_adapter *adapter = netdev_priv(netdev); +	bool
 need_reset; +	int rc;
+
+	/* The hardware requires that RX vlan stripping and TX vlan

insertion + * be configured together. Therefore, if one setting
changes adjust the + * other one to match. + */

drivers/net/ixgb/ixgb_ethtool.c +8 -0
+	if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+		if ((data & ETH_FLAG_RXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_RX))
+			data ^= ETH_FLAG_TXVLAN;
+		else if ((data & ETH_FLAG_TXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_TX))
+			data ^= ETH_FLAG_RXVLAN;
+	}

[...]

Quoted 8 lines
Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Document the limitation in Documentation/networking/ixgb.txt. You could also send a patch for the ethtool manual page stating that this restriction might exist.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#4 lore raw
Quoted 40 lines · Ben Hutchings
Quoted 30 lines · Emil S
Quoted 29 lines · Ben Hutchings
Quoted 26 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...] diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 43994c1..0e4c527 100644

drivers/net/ixgb/ixgb_ethtool.c +2 -0
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev,
 u32  stringset, u8 *data)  	} } 
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data) +{
+	struct ixgb_adapter *adapter = netdev_priv(netdev); +	bool

need_reset; + int rc; +

drivers/net/ixgb/ixgb_ethtool.c +1 -0
+	/* The hardware requires that RX vlan stripping and TX vlan

insertion + * be configured together. Therefore, if one setting
changes adjust the + * other one to match. + */

drivers/net/ixgb/ixgb_ethtool.c +8 -0
+	if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+		if ((data & ETH_FLAG_RXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_RX))
+			data ^= ETH_FLAG_TXVLAN;
+		else if ((data & ETH_FLAG_TXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_TX))
+			data ^= ETH_FLAG_RXVLAN;
+	}

[...]

Quoted 8 lines
Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Quoted 5 lines

Document the limitation in Documentation/networking/ixgb.txt. You could also send a patch for the ethtool manual page stating that this restriction might exist.

Ben.

Just to make sure it's clear - there is no hard requirement for both settings to be set at the same time. So setting:
ethtool -K eth0 rxvlan off

Is a valid setting and will disable stripping on Rx, but because of the design, stripping on Tx will also be disabled.

In order for Tx tag insertion to work:
CTRL0.VME = 1 and VLE in TX desc = 1

In order for Rx tag stripping to work:
CTRL0.VME = 1

Based on this I think it's justified to adjust Tx when Rx is disabled as it basically reflects the actual state of affairs.

But we should allow Tx to be disabled separately of Rx (CTRL0.VME=1, VLE=0/1).

Either way we should update the docs as it is not intuitive.

Thanks,
Emil

#5 lore raw
Quoted 45 lines · Emil S
Quoted 44 lines · Ben Hutchings
Quoted 30 lines · Emil S
Quoted 29 lines · Ben Hutchings
Quoted 26 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...] diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 43994c1..0e4c527 100644

drivers/net/ixgb/ixgb_ethtool.c +2 -0
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev,
 u32  stringset, u8 *data)  	} } 
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data) +{
+	struct ixgb_adapter *adapter = netdev_priv(netdev); +	bool

need_reset; + int rc; +

drivers/net/ixgb/ixgb_ethtool.c +1 -0
+	/* The hardware requires that RX vlan stripping and TX vlan

insertion + * be configured together. Therefore, if one setting
changes adjust the + * other one to match. + */

drivers/net/ixgb/ixgb_ethtool.c +8 -0
+	if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+		if ((data & ETH_FLAG_RXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_RX))
+			data ^= ETH_FLAG_TXVLAN;
+		else if ((data & ETH_FLAG_TXVLAN) !=
+		    (netdev->features & NETIF_F_HW_VLAN_TX))
+			data ^= ETH_FLAG_RXVLAN;
+	}

[...]

Quoted 8 lines
Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Document the limitation in Documentation/networking/ixgb.txt. You could also send a patch for the ethtool manual page stating that this restriction might exist.

Quoted 8 lines
Quoted 1 line

Ben.

Just to make sure it's clear - there is no hard requirement for both settings to be set at the same time. So setting:
ethtool -K eth0 rxvlan off

Is a valid setting and will disable stripping on Rx, but because of the design, stripping on Tx will also be disabled.

Then it's *not* a valid setting for your hardware/driver.

[...]

Quoted 1 line

Either way we should update the docs as it is not intuitive.

Yes.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#6 lore raw
Quoted 48 lines · Ben Hutchings
Quoted 47 lines · Emil S
Quoted 45 lines · Ben Hutchings
Quoted 30 lines · Emil S
Quoted 29 lines · Ben Hutchings
Quoted 26 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...] diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 43994c1..0e4c527 100644

drivers/net/ixgb/ixgb_ethtool.c +2 -0
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev,
 u32  stringset, u8 *data)        } }
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data) +{
+        struct ixgb_adapter *adapter = netdev_priv(netdev); +   bool

need_reset; +    int rc; +
+        /* The hardware requires that RX vlan stripping and TX vlan insertion +       * be configured together.  Therefore, if one setting changes adjust the +      * other one to match. +         */
+        if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+                if ((data & ETH_FLAG_RXVLAN) !=
+                    (netdev->features & NETIF_F_HW_VLAN_RX))
+                        data ^= ETH_FLAG_TXVLAN;
+                else if ((data & ETH_FLAG_TXVLAN) !=
+                    (netdev->features & NETIF_F_HW_VLAN_TX))
+                        data ^= ETH_FLAG_RXVLAN;
+        }

[...]

Quoted 8 lines
Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Document the limitation in Documentation/networking/ixgb.txt.  You could also send a patch for the ethtool manual page stating that this restriction might exist.

Ben.

Quoted 8 lines
Quoted 6 lines

Just to make sure it's clear - there is no hard requirement for both settings to be set at the same time. So setting:
ethtool -K eth0 rxvlan off

Is a valid setting and will disable stripping on Rx, but because of the design, stripping on Tx will also be disabled.

Then it's *not* a valid setting for your hardware/driver.

Ben, I agree that limiting the settings to what is actually supported is conceptually cleaner but in practice it's not very intuitive. If you try to turn something off and the response is that it's invalid, most people are going to assume that you just can't do it. This is especially true since you actually can't turn these settings off in most drivers.

There's a precedent for this type of thing: turn off TX checksum offloading and watch scatter/gather and TSO be automatically disabled as well. It makes sense - the user requested a change, we do what is necessary to make that happen without requiring them to understand why these features are interrelated.

Emil, I realized afterwards that, as you pointed out, TX vlan offloading can be disabled without requiring RX offloading to be disabled. Feel free to make the modification yourself or I can resubmit, whichever is easier.

#7 lore raw
Quoted 7 lines · Jesse Gross
Quoted 5 lines · Ben Hutchings
Quoted 4 lines · Emil S
Quoted 3 lines · Ben Hutchings
Quoted 2 lines · Emil S
Quoted 1 line · Ben Hutchings

On Mon, 2010-12-13 at 19:42 -0800, Jesse Gross wrote:

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

[...]

Quoted 7 lines

Ben, I agree that limiting the settings to what is actually supported is conceptually cleaner but in practice it's not very intuitive. If you try to turn something off and the response is that it's invalid, most people are going to assume that you just can't do it. This is especially true since you actually can't turn these settings off in most drivers.

Quoted 5 lines

There's a precedent for this type of thing: turn off TX checksum offloading and watch scatter/gather and TSO be automatically disabled as well. It makes sense - the user requested a change, we do what is necessary to make that happen without requiring them to understand why these features are interrelated.

That reflects a general dependency and not a driver- or hardware- specific restriction. But I see your point.

Perhaps the ethtool utility should check the result after applying offload changes and report any additional automatic changes.

Ben.

Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#8 lore raw
Quoted 25 lines · Ben Hutchings
Quoted 7 lines · Jesse Gross
Quoted 5 lines · Ben Hutchings
Quoted 4 lines · Emil S
Quoted 3 lines · Ben Hutchings
Quoted 2 lines · Emil S
Quoted 1 line · Ben Hutchings

On Mon, 2010-12-13 at 19:42 -0800, Jesse Gross wrote:

[...]

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

[...]

Quoted 7 lines

Ben, I agree that limiting the settings to what is actually supported is conceptually cleaner but in practice it's not very intuitive.  If you try to turn something off and the response is that it's invalid, most people are going to assume that you just can't do it.  This is especially true since you actually can't turn these settings off in most drivers.

Quoted 5 lines

There's a precedent for this type of thing: turn off TX checksum offloading and watch scatter/gather and TSO be automatically disabled as well.  It makes sense - the user requested a change, we do what is necessary to make that happen without requiring them to understand why these features are interrelated.

Quoted 5 lines

That reflects a general dependency and not a driver- or hardware- specific restriction.  But I see your point.

Perhaps the ethtool utility should check the result after applying offload changes and report any additional automatic changes.

That sounds like the best solution to me.

#9 lore raw
In reply to Jesse Gross
Quoted 71 lines · Jesse Gross
Quoted 47 lines · Ben Hutchings
Quoted 46 lines · Emil S
Quoted 44 lines · Ben Hutchings
Quoted 29 lines · Emil S
Quoted 28 lines · Ben Hutchings
Quoted 25 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...] diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 43994c1..0e4c527 100644

drivers/net/ixgb/ixgb_ethtool.c +3 -0
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev,
 u32  stringset, u8 *data)        } }
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data)
+{ +        struct ixgb_adapter *adapter = netdev_priv(netdev);
+   bool need_reset; +    int rc; + +        /* The hardware

requires that RX vlan stripping and TX vlan insertion +       * be configured together.  Therefore, if one setting changes adjust the +      * other one to match. +         */ + if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+                if ((data & ETH_FLAG_RXVLAN) != + (netdev->features & NETIF_F_HW_VLAN_RX)) +
data ^= ETH_FLAG_TXVLAN; +                else if ((data & ETH_FLAG_TXVLAN) != +                    (netdev->features & NETIF_F_HW_VLAN_TX)) +                        data ^= ETH_FLAG_RXVLAN; +        }

[...]

Quoted 8 lines
Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Document the limitation in Documentation/networking/ixgb.txt.  You could also send a patch for the ethtool manual page stating that this restriction might exist.

Ben.

Quoted 8 lines
Quoted 6 lines

Just to make sure it's clear - there is no hard requirement for both settings to be set at the same time. So setting:
ethtool -K eth0 rxvlan off

Is a valid setting and will disable stripping on Rx, but because of the design, stripping on Tx will also be disabled.

Then it's *not* a valid setting for your hardware/driver.

Ben, I agree that limiting the settings to what is actually supported is conceptually cleaner but in practice it's not very intuitive. If you try to turn something off and the response is that it's invalid, most people are going to assume that you just can't do it. This is especially true since you actually can't turn these settings off in most drivers.

There's a precedent for this type of thing: turn off TX checksum offloading and watch scatter/gather and TSO be automatically disabled as well. It makes sense - the user requested a change, we do what is necessary to make that happen without requiring them to understand why these features are interrelated.

Quoted 4 lines

Emil, I realized afterwards that, as you pointed out, TX vlan offloading can be disabled without requiring RX offloading to be disabled. Feel free to make the modification yourself or I can resubmit, whichever is easier.

If it's OK with you I can make whatever changes are needed since I need to test this first, so I don't want to go back and forth in case we find other issues in testing.

Thanks,
Emil

#11 lore raw
In reply to Jesse Gross
Quoted 9 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured.

CC Emil Tantilov <[email protected]>
CC Jeff Kirsher <[email protected]>
CC Alex Duyck <[email protected]>
Quoted 6 lines

---
 drivers/net/ixgb/ixgb.h         |    2 +- drivers/net/ixgb/ixgb_ethtool.c |   41 +++++++++++++++++++++++++++++ drivers/net/ixgb/ixgb_main.c    |   54 ++++++++------------------------------

 3 files changed, 54 insertions(+), 43 deletions(-)

I have added this patch to my tree for testing and review. Thanks Jesse.

Signature · 2 lines
Cheers,
Jeff
#10 lore raw
In reply to Tantilov, Emil S
Quoted 72 lines · Emil S
Quoted 71 lines · Jesse Gross
Quoted 47 lines · Ben Hutchings
Quoted 46 lines · Emil S
Quoted 44 lines · Ben Hutchings
Quoted 29 lines · Emil S
Quoted 28 lines · Ben Hutchings
Quoted 25 lines · Jesse Gross

This switches the ixgb driver to use the new vlan interfaces. In doing this, it completes the work begun in ae54496f9e8d40c89e5668205c181dccfa9ecda1 allowing the use of hardware vlan insertion without having a vlan group configured. [...] diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 43994c1..0e4c527 100644

drivers/net/ixgb/ixgb_ethtool.c +3 -0
@@ -706,6 +706,45 @@ ixgb_get_strings(struct net_device *netdev,
 u32  stringset, u8 *data)        } }
 
+static int ixgb_set_flags(struct net_device *netdev, u32 data)
+{ +        struct ixgb_adapter *adapter = netdev_priv(netdev);
+   bool need_reset; +    int rc; + +        /* The hardware

requires that RX vlan stripping and TX vlan insertion +       * be configured together.  Therefore, if one setting changes adjust the +      * other one to match. +         */ + if (!!(data & ETH_FLAG_RXVLAN) != !!(data & ETH_FLAG_TXVLAN)) {
+                if ((data & ETH_FLAG_RXVLAN) != + (netdev->features & NETIF_F_HW_VLAN_RX)) +
data ^= ETH_FLAG_TXVLAN; +                else if ((data & ETH_FLAG_TXVLAN) != +                    (netdev->features & NETIF_F_HW_VLAN_TX)) +                        data ^= ETH_FLAG_RXVLAN; +        }

[...]

Quoted 8 lines
Quoted 4 lines

I think this should reject attempts to change just one flag with -EINVAL, rather than quietly 'fixing' the setting.

Ben.

I'm not sure this is a good idea. At least not without some sort of explanation. Since there is no way for the user to know that he needs to disable both.

Document the limitation in Documentation/networking/ixgb.txt.  You could also send a patch for the ethtool manual page stating that this restriction might exist.

Ben.

Quoted 8 lines
Quoted 6 lines

Just to make sure it's clear - there is no hard requirement for both settings to be set at the same time. So setting:
ethtool -K eth0 rxvlan off

Is a valid setting and will disable stripping on Rx, but because of the design, stripping on Tx will also be disabled.

Then it's *not* a valid setting for your hardware/driver.

Ben, I agree that limiting the settings to what is actually supported is conceptually cleaner but in practice it's not very intuitive.  If you try to turn something off and the response is that it's invalid, most people are going to assume that you just can't do it.  This is especially true since you actually can't turn these settings off in most drivers.

There's a precedent for this type of thing: turn off TX checksum offloading and watch scatter/gather and TSO be automatically disabled as well.  It makes sense - the user requested a change, we do what is necessary to make that happen without requiring them to understand why these features are interrelated.

Quoted 8 lines
Quoted 4 lines

Emil, I realized afterwards that, as you pointed out, TX vlan offloading can be disabled without requiring RX offloading to be disabled.  Feel free to make the modification yourself or I can resubmit, whichever is easier.

If it's OK with you I can make whatever changes are needed since I need to test this first, so I don't want to go back and forth in case we find other issues in testing.

Yes, please go ahead and make the necessary changes - I'm really just interested in the end result.