diff mbox

[net-next,3/3] net: fullly using NETIF_F_ALL_TSO

Message ID 4DB16187.2030904@cn.fujitsu.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Shan Wei April 22, 2011, 11:07 a.m. UTC
Fullly using NETIF_F_ALL_TSO.
And some code style tuning. Just compile test.


Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
---
 drivers/net/bnx2x/bnx2x_main.c     |    6 +++---
 drivers/net/cxgb4/cxgb4_main.c     |    5 ++---
 drivers/net/cxgb4vf/cxgb4vf_main.c |    9 ++-------
 drivers/net/enic/enic_main.c       |    3 +--
 drivers/net/ifb.c                  |    3 +--
 drivers/net/qlge/qlge_main.c       |    3 +--
 6 files changed, 10 insertions(+), 19 deletions(-)

Comments

Ben Hutchings April 22, 2011, 2:14 p.m. UTC | #1
On Fri, 2011-04-22 at 19:07 +0800, Shan Wei wrote:
> Fullly using NETIF_F_ALL_TSO.
> And some code style tuning. Just compile test.
[...]

This is wrong.  What if some other TSO feature is defined and added to
NETIF_F_ALL_TSO later?  (This is unlikely, but hopefully you see that it
is conceptually wrong to claim 'all' features.)

Ben.
Dimitris Michailidis April 22, 2011, 3:45 p.m. UTC | #2
On 04/22/2011 04:07 AM, Shan Wei wrote:
>  
> Fullly using NETIF_F_ALL_TSO.
> And some code style tuning. Just compile test.

This would make drivers automatically claim to support any new TSO feature 
the moment the feature is added.  I think drivers should have to explicitly 
opt in if they are capable and ready.

You could use NETIF_F_ALL_TSO for vlan_features, which is a mask, but not 
hw_features.

> 
> 
> Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
> ---
>  drivers/net/bnx2x/bnx2x_main.c     |    6 +++---
>  drivers/net/cxgb4/cxgb4_main.c     |    5 ++---
>  drivers/net/cxgb4vf/cxgb4vf_main.c |    9 ++-------
>  drivers/net/enic/enic_main.c       |    3 +--
>  drivers/net/ifb.c                  |    3 +--
>  drivers/net/qlge/qlge_main.c       |    3 +--
>  6 files changed, 10 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
> index bfd7ac9..1d47b05 100644
> --- a/drivers/net/bnx2x/bnx2x_main.c
> +++ b/drivers/net/bnx2x/bnx2x_main.c
> @@ -9425,11 +9425,11 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
>  	bnx2x_set_ethtool_ops(dev);
>  
>  	dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
> -		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
> -		NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_TX;
> +			   NETIF_F_ALL_TSO | NETIF_F_RXCSUM | NETIF_F_LRO |
> +			   NETIF_F_HW_VLAN_TX;
>  
>  	dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
> -		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
> +			     NETIF_F_ALL_TSO | NETIF_F_HIGHDMA;
>  
>  	dev->features |= dev->hw_features | NETIF_F_HW_VLAN_RX;
>  	if (bp->flags & USING_DAC_FLAG)
> diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
> index bdc868c..916484d 100644
> --- a/drivers/net/cxgb4/cxgb4_main.c
> +++ b/drivers/net/cxgb4/cxgb4_main.c
> @@ -3525,8 +3525,7 @@ static void free_some_resources(struct adapter *adapter)
>  		t4_fw_bye(adapter, adapter->fn);
>  }
>  
> -#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
> -#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \
> +#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_ALL_TSO | \
>  		   NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)
>  
>  static int __devinit init_one(struct pci_dev *pdev,
> @@ -3630,7 +3629,7 @@ static int __devinit init_one(struct pci_dev *pdev,
>  		pi->port_id = i;
>  		netdev->irq = pdev->irq;
>  
> -		netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
> +		netdev->hw_features = NETIF_F_SG | NETIF_F_ALL_TSO |
>  			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>  			NETIF_F_RXCSUM | NETIF_F_RXHASH |
>  			NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
> diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
> index 8cf9890..f8fb8e3 100644
> --- a/drivers/net/cxgb4vf/cxgb4vf_main.c
> +++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
> @@ -1540,11 +1540,6 @@ static void cxgb4vf_get_wol(struct net_device *dev,
>  	memset(&wol->sopass, 0, sizeof(wol->sopass));
>  }
>  
> -/*
> - * TCP Segmentation Offload flags which we support.
> - */
> -#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
> -
>  static struct ethtool_ops cxgb4vf_ethtool_ops = {
>  	.get_settings		= cxgb4vf_get_settings,
>  	.get_drvinfo		= cxgb4vf_get_drvinfo,
> @@ -2600,10 +2595,10 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
>  		netif_carrier_off(netdev);
>  		netdev->irq = pdev->irq;
>  
> -		netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
> +		netdev->hw_features = NETIF_F_SG | NETIF_F_ALL_TSO |
>  			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>  			NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
> -		netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
> +		netdev->vlan_features = NETIF_F_SG | NETIF_F_ALL_TSO |
>  			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
>  			NETIF_F_HIGHDMA;
>  		netdev->features = netdev->hw_features |
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
> index b224551..1a03a74 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -2381,8 +2381,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
>  	if (ENIC_SETTING(enic, TXCSUM))
>  		netdev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
>  	if (ENIC_SETTING(enic, TSO))
> -		netdev->hw_features |= NETIF_F_TSO |
> -			NETIF_F_TSO6 | NETIF_F_TSO_ECN;
> +		netdev->hw_features |= NETIF_F_ALL_TSO;
>  	if (ENIC_SETTING(enic, RXCSUM))
>  		netdev->hw_features |= NETIF_F_RXCSUM;
>  
> diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
> index e07d487..c41b822 100644
> --- a/drivers/net/ifb.c
> +++ b/drivers/net/ifb.c
> @@ -127,8 +127,7 @@ static const struct net_device_ops ifb_netdev_ops = {
>  };
>  
>  #define IFB_FEATURES (NETIF_F_NO_CSUM | NETIF_F_SG  | NETIF_F_FRAGLIST	| \
> -		      NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6	| \
> -		      NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX)
> +		      NETIF_F_ALL_TSO | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX)
>  
>  static void ifb_setup(struct net_device *dev)
>  {
> diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
> index 6c9d124..709aaa6 100644
> --- a/drivers/net/qlge/qlge_main.c
> +++ b/drivers/net/qlge/qlge_main.c
> @@ -4695,8 +4695,7 @@ static int __devinit qlge_probe(struct pci_dev *pdev,
>  	qdev = netdev_priv(ndev);
>  	SET_NETDEV_DEV(ndev, &pdev->dev);
>  	ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
> -		NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN |
> -		NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
> +		NETIF_F_ALL_TSO | NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
>  	ndev->features = ndev->hw_features |
>  		NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
>  

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

Patch

diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index bfd7ac9..1d47b05 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -9425,11 +9425,11 @@  static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
 	bnx2x_set_ethtool_ops(dev);
 
 	dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
-		NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_TX;
+			   NETIF_F_ALL_TSO | NETIF_F_RXCSUM | NETIF_F_LRO |
+			   NETIF_F_HW_VLAN_TX;
 
 	dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-		NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA;
+			     NETIF_F_ALL_TSO | NETIF_F_HIGHDMA;
 
 	dev->features |= dev->hw_features | NETIF_F_HW_VLAN_RX;
 	if (bp->flags & USING_DAC_FLAG)
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index bdc868c..916484d 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -3525,8 +3525,7 @@  static void free_some_resources(struct adapter *adapter)
 		t4_fw_bye(adapter, adapter->fn);
 }
 
-#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
-#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \
+#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_ALL_TSO | \
 		   NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)
 
 static int __devinit init_one(struct pci_dev *pdev,
@@ -3630,7 +3629,7 @@  static int __devinit init_one(struct pci_dev *pdev,
 		pi->port_id = i;
 		netdev->irq = pdev->irq;
 
-		netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
+		netdev->hw_features = NETIF_F_SG | NETIF_F_ALL_TSO |
 			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 			NETIF_F_RXCSUM | NETIF_F_RXHASH |
 			NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index 8cf9890..f8fb8e3 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -1540,11 +1540,6 @@  static void cxgb4vf_get_wol(struct net_device *dev,
 	memset(&wol->sopass, 0, sizeof(wol->sopass));
 }
 
-/*
- * TCP Segmentation Offload flags which we support.
- */
-#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
-
 static struct ethtool_ops cxgb4vf_ethtool_ops = {
 	.get_settings		= cxgb4vf_get_settings,
 	.get_drvinfo		= cxgb4vf_get_drvinfo,
@@ -2600,10 +2595,10 @@  static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
 		netif_carrier_off(netdev);
 		netdev->irq = pdev->irq;
 
-		netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
+		netdev->hw_features = NETIF_F_SG | NETIF_F_ALL_TSO |
 			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 			NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
-		netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
+		netdev->vlan_features = NETIF_F_SG | NETIF_F_ALL_TSO |
 			NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 			NETIF_F_HIGHDMA;
 		netdev->features = netdev->hw_features |
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index b224551..1a03a74 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -2381,8 +2381,7 @@  static int __devinit enic_probe(struct pci_dev *pdev,
 	if (ENIC_SETTING(enic, TXCSUM))
 		netdev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
 	if (ENIC_SETTING(enic, TSO))
-		netdev->hw_features |= NETIF_F_TSO |
-			NETIF_F_TSO6 | NETIF_F_TSO_ECN;
+		netdev->hw_features |= NETIF_F_ALL_TSO;
 	if (ENIC_SETTING(enic, RXCSUM))
 		netdev->hw_features |= NETIF_F_RXCSUM;
 
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
index e07d487..c41b822 100644
--- a/drivers/net/ifb.c
+++ b/drivers/net/ifb.c
@@ -127,8 +127,7 @@  static const struct net_device_ops ifb_netdev_ops = {
 };
 
 #define IFB_FEATURES (NETIF_F_NO_CSUM | NETIF_F_SG  | NETIF_F_FRAGLIST	| \
-		      NETIF_F_TSO_ECN | NETIF_F_TSO | NETIF_F_TSO6	| \
-		      NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX)
+		      NETIF_F_ALL_TSO | NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX)
 
 static void ifb_setup(struct net_device *dev)
 {
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 6c9d124..709aaa6 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -4695,8 +4695,7 @@  static int __devinit qlge_probe(struct pci_dev *pdev,
 	qdev = netdev_priv(ndev);
 	SET_NETDEV_DEV(ndev, &pdev->dev);
 	ndev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM |
-		NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN |
-		NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
+		NETIF_F_ALL_TSO | NETIF_F_HW_VLAN_TX | NETIF_F_RXCSUM;
 	ndev->features = ndev->hw_features |
 		NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;