netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers
@ 2010-10-22  4:05 Harvey Harrison
  2010-10-22  4:05 ` [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers Harvey Harrison
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Harvey Harrison @ 2010-10-22  4:05 UTC (permalink / raw)
  To: sbhatewara; +Cc: netdev, shemminger

It's easier to just annotate the constants as little endian types and set/clear
the flags directly.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/net/vmxnet3/upt1_defs.h       |    8 ++++----
 drivers/net/vmxnet3/vmxnet3_defs.h    |    6 +++---
 drivers/net/vmxnet3/vmxnet3_drv.c     |   20 +++++++++-----------
 drivers/net/vmxnet3/vmxnet3_ethtool.c |   14 ++++++--------
 drivers/net/vmxnet3/vmxnet3_int.h     |   15 ---------------
 5 files changed, 22 insertions(+), 41 deletions(-)

diff --git a/drivers/net/vmxnet3/upt1_defs.h b/drivers/net/vmxnet3/upt1_defs.h
index 37108fb..969c751 100644
--- a/drivers/net/vmxnet3/upt1_defs.h
+++ b/drivers/net/vmxnet3/upt1_defs.h
@@ -88,9 +88,9 @@ struct UPT1_RSSConf {
 
 /* features */
 enum {
-	UPT1_F_RXCSUM		= 0x0001,   /* rx csum verification */
-	UPT1_F_RSS		= 0x0002,
-	UPT1_F_RXVLAN		= 0x0004,   /* VLAN tag stripping */
-	UPT1_F_LRO		= 0x0008,
+	UPT1_F_RXCSUM		= cpu_to_le64(0x0001),   /* rx csum verification */
+	UPT1_F_RSS		= cpu_to_le64(0x0002),
+	UPT1_F_RXVLAN		= cpu_to_le64(0x0004),   /* VLAN tag stripping */
+	UPT1_F_LRO		= cpu_to_le64(0x0008),
 };
 #endif
diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h
index ca7727b..4d84912 100644
--- a/drivers/net/vmxnet3/vmxnet3_defs.h
+++ b/drivers/net/vmxnet3/vmxnet3_defs.h
@@ -523,9 +523,9 @@ struct Vmxnet3_RxFilterConf {
 #define VMXNET3_PM_MAX_PATTERN_SIZE   128
 #define VMXNET3_PM_MAX_MASK_SIZE      (VMXNET3_PM_MAX_PATTERN_SIZE / 8)
 
-#define VMXNET3_PM_WAKEUP_MAGIC       0x01  /* wake up on magic pkts */
-#define VMXNET3_PM_WAKEUP_FILTER      0x02  /* wake up on pkts matching
-					     * filters */
+#define VMXNET3_PM_WAKEUP_MAGIC       cpu_to_le16(0x01)  /* wake up on magic pkts */
+#define VMXNET3_PM_WAKEUP_FILTER      cpu_to_le16(0x02)  /* wake up on pkts matching
+							  * filters */
 
 
 struct Vmxnet3_PM_PktFilter {
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 3f60e0e..2ea4b81 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -1563,8 +1563,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 			adapter->vlan_grp = grp;
 
 			/* update FEATURES to device */
-			set_flag_le64(&devRead->misc.uptFeatures,
-				      UPT1_F_RXVLAN);
+			devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
 			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 					       VMXNET3_CMD_UPDATE_FEATURE);
 			/*
@@ -1587,7 +1586,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 		struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
 		adapter->vlan_grp = NULL;
 
-		if (le64_to_cpu(devRead->misc.uptFeatures) & UPT1_F_RXVLAN) {
+		if (devRead->misc.uptFeatures & UPT1_F_RXVLAN) {
 			int i;
 
 			for (i = 0; i < VMXNET3_VFT_SIZE; i++) {
@@ -1600,8 +1599,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 					       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
 
 			/* update FEATURES to device */
-			reset_flag_le64(&devRead->misc.uptFeatures,
-					UPT1_F_RXVLAN);
+			devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN;
 			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 					       VMXNET3_CMD_UPDATE_FEATURE);
 		}
@@ -1762,15 +1760,15 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
 
 	/* set up feature flags */
 	if (adapter->rxcsum)
-		set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_RXCSUM);
+		devRead->misc.uptFeatures |= UPT1_F_RXCSUM;
 
 	if (adapter->lro) {
-		set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_LRO);
+		devRead->misc.uptFeatures |= UPT1_F_LRO;
 		devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS);
 	}
 	if ((adapter->netdev->features & NETIF_F_HW_VLAN_RX) &&
 	    adapter->vlan_grp) {
-		set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_RXVLAN);
+		devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
 	}
 
 	devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
@@ -2577,7 +2575,7 @@ vmxnet3_suspend(struct device *device)
 		memcpy(pmConf->filters[i].pattern, netdev->dev_addr, ETH_ALEN);
 		pmConf->filters[i].mask[0] = 0x3F; /* LSB ETH_ALEN bits */
 
-		set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_FILTER);
+		pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
 		i++;
 	}
 
@@ -2619,13 +2617,13 @@ vmxnet3_suspend(struct device *device)
 		pmConf->filters[i].mask[5] = 0x03; /* IPv4 TIP */
 		in_dev_put(in_dev);
 
-		set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_FILTER);
+		pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
 		i++;
 	}
 
 skip_arp:
 	if (adapter->wol & WAKE_MAGIC)
-		set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_MAGIC);
+		pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_MAGIC;
 
 	pmConf->numFilters = i;
 
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index 7e4b5a8..b79070b 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -50,13 +50,11 @@ vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
 		adapter->rxcsum = val;
 		if (netif_running(netdev)) {
 			if (val)
-				set_flag_le64(
-				&adapter->shared->devRead.misc.uptFeatures,
-				UPT1_F_RXCSUM);
+				adapter->shared->devRead.misc.uptFeatures |=
+				UPT1_F_RXCSUM;
 			else
-				reset_flag_le64(
-				&adapter->shared->devRead.misc.uptFeatures,
-				UPT1_F_RXCSUM);
+				adapter->shared->devRead.misc.uptFeatures &=
+				~UPT1_F_RXCSUM;
 
 			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 					       VMXNET3_CMD_UPDATE_FEATURE);
@@ -292,10 +290,10 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
 		/* update harware LRO capability accordingly */
 		if (lro_requested)
 			adapter->shared->devRead.misc.uptFeatures |=
-						cpu_to_le64(UPT1_F_LRO);
+							UPT1_F_LRO;
 		else
 			adapter->shared->devRead.misc.uptFeatures &=
-						cpu_to_le64(~UPT1_F_LRO);
+							~UPT1_F_LRO;
 		VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 				       VMXNET3_CMD_UPDATE_FEATURE);
 	}
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index c88ea5c..46aee6d 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -353,21 +353,6 @@ struct vmxnet3_adapter {
 #define VMXNET3_MAX_ETH_HDR_SIZE    22
 #define VMXNET3_MAX_SKB_BUF_SIZE    (3*1024)
 
-static inline void set_flag_le16(__le16 *data, u16 flag)
-{
-	*data = cpu_to_le16(le16_to_cpu(*data) | flag);
-}
-
-static inline void set_flag_le64(__le64 *data, u64 flag)
-{
-	*data = cpu_to_le64(le64_to_cpu(*data) | flag);
-}
-
-static inline void reset_flag_le64(__le64 *data, u64 flag)
-{
-	*data = cpu_to_le64(le64_to_cpu(*data) & ~flag);
-}
-
 int
 vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers
  2010-10-22  4:05 [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Harvey Harrison
@ 2010-10-22  4:05 ` Harvey Harrison
  2010-10-22 17:30   ` Shreyas Bhatewara
  2010-10-24 22:43   ` David Miller
  2010-10-22  4:05 ` [PATCH 3/3] vmxnet3: fix typo setting confPA Harvey Harrison
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: Harvey Harrison @ 2010-10-22  4:05 UTC (permalink / raw)
  To: sbhatewara; +Cc: netdev, shemminger

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/net/vmxnet3/vmxnet3_int.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 46aee6d..8a2f471 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -301,8 +301,8 @@ struct vmxnet3_adapter {
 	struct net_device              *netdev;
 	struct pci_dev                 *pdev;
 
-	u8				*hw_addr0; /* for BAR 0 */
-	u8				*hw_addr1; /* for BAR 1 */
+	u8			__iomem *hw_addr0; /* for BAR 0 */
+	u8			__iomem *hw_addr1; /* for BAR 1 */
 
 	/* feature control */
 	bool				rxcsum;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22  4:05 [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Harvey Harrison
  2010-10-22  4:05 ` [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers Harvey Harrison
@ 2010-10-22  4:05 ` Harvey Harrison
  2010-10-22 17:31   ` Shreyas Bhatewara
  2010-10-24 22:43   ` David Miller
  2010-10-22 17:29 ` [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Shreyas Bhatewara
  2010-10-24 22:43 ` David Miller
  3 siblings, 2 replies; 15+ messages in thread
From: Harvey Harrison @ 2010-10-22  4:05 UTC (permalink / raw)
  To: sbhatewara; +Cc: netdev, shemminger

It's a le64, not a le32, typo in one place only.

Noticed by sparse:
drivers/net/vmxnet3/vmxnet3_drv.c:2668:52: warning: incorrect type in assignment (different base types)
drivers/net/vmxnet3/vmxnet3_drv.c:2668:52:    expected restricted __le64 [usertype] confPA
drivers/net/vmxnet3/vmxnet3_drv.c:2668:52:    got restricted __le32 [usertype] <noident>

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/net/vmxnet3/vmxnet3_drv.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 2ea4b81..e3658e1 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -2665,7 +2665,7 @@ vmxnet3_resume(struct device *device)
 	adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1);
 	adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof(
 								  *pmConf));
-	adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le32(virt_to_phys(
+	adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le64(virt_to_phys(
 								 pmConf));
 
 	netif_device_attach(netdev);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers
  2010-10-22  4:05 [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Harvey Harrison
  2010-10-22  4:05 ` [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers Harvey Harrison
  2010-10-22  4:05 ` [PATCH 3/3] vmxnet3: fix typo setting confPA Harvey Harrison
@ 2010-10-22 17:29 ` Shreyas Bhatewara
  2010-10-24 22:43 ` David Miller
  3 siblings, 0 replies; 15+ messages in thread
From: Shreyas Bhatewara @ 2010-10-22 17:29 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com


Harvey,
Thanks for doing this.

Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>


On Thu, 21 Oct 2010, Harvey Harrison wrote:

> It's easier to just annotate the constants as little endian types and set/clear
> the flags directly.
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  drivers/net/vmxnet3/upt1_defs.h       |    8 ++++----
>  drivers/net/vmxnet3/vmxnet3_defs.h    |    6 +++---
>  drivers/net/vmxnet3/vmxnet3_drv.c     |   20 +++++++++-----------
>  drivers/net/vmxnet3/vmxnet3_ethtool.c |   14 ++++++--------
>  drivers/net/vmxnet3/vmxnet3_int.h     |   15 ---------------
>  5 files changed, 22 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/net/vmxnet3/upt1_defs.h b/drivers/net/vmxnet3/upt1_defs.h
> index 37108fb..969c751 100644
> --- a/drivers/net/vmxnet3/upt1_defs.h
> +++ b/drivers/net/vmxnet3/upt1_defs.h
> @@ -88,9 +88,9 @@ struct UPT1_RSSConf {
>  
>  /* features */
>  enum {
> -	UPT1_F_RXCSUM		= 0x0001,   /* rx csum verification */
> -	UPT1_F_RSS		= 0x0002,
> -	UPT1_F_RXVLAN		= 0x0004,   /* VLAN tag stripping */
> -	UPT1_F_LRO		= 0x0008,
> +	UPT1_F_RXCSUM		= cpu_to_le64(0x0001),   /* rx csum verification */
> +	UPT1_F_RSS		= cpu_to_le64(0x0002),
> +	UPT1_F_RXVLAN		= cpu_to_le64(0x0004),   /* VLAN tag stripping */
> +	UPT1_F_LRO		= cpu_to_le64(0x0008),
>  };
>  #endif
> diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h
> index ca7727b..4d84912 100644
> --- a/drivers/net/vmxnet3/vmxnet3_defs.h
> +++ b/drivers/net/vmxnet3/vmxnet3_defs.h
> @@ -523,9 +523,9 @@ struct Vmxnet3_RxFilterConf {
>  #define VMXNET3_PM_MAX_PATTERN_SIZE   128
>  #define VMXNET3_PM_MAX_MASK_SIZE      (VMXNET3_PM_MAX_PATTERN_SIZE / 8)
>  
> -#define VMXNET3_PM_WAKEUP_MAGIC       0x01  /* wake up on magic pkts */
> -#define VMXNET3_PM_WAKEUP_FILTER      0x02  /* wake up on pkts matching
> -					     * filters */
> +#define VMXNET3_PM_WAKEUP_MAGIC       cpu_to_le16(0x01)  /* wake up on magic pkts */
> +#define VMXNET3_PM_WAKEUP_FILTER      cpu_to_le16(0x02)  /* wake up on pkts matching
> +							  * filters */
>  
>  
>  struct Vmxnet3_PM_PktFilter {
> diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
> index 3f60e0e..2ea4b81 100644
> --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
> @@ -1563,8 +1563,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
>  			adapter->vlan_grp = grp;
>  
>  			/* update FEATURES to device */
> -			set_flag_le64(&devRead->misc.uptFeatures,
> -				      UPT1_F_RXVLAN);
> +			devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
>  			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
>  					       VMXNET3_CMD_UPDATE_FEATURE);
>  			/*
> @@ -1587,7 +1586,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
>  		struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
>  		adapter->vlan_grp = NULL;
>  
> -		if (le64_to_cpu(devRead->misc.uptFeatures) & UPT1_F_RXVLAN) {
> +		if (devRead->misc.uptFeatures & UPT1_F_RXVLAN) {
>  			int i;
>  
>  			for (i = 0; i < VMXNET3_VFT_SIZE; i++) {
> @@ -1600,8 +1599,7 @@ vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
>  					       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
>  
>  			/* update FEATURES to device */
> -			reset_flag_le64(&devRead->misc.uptFeatures,
> -					UPT1_F_RXVLAN);
> +			devRead->misc.uptFeatures &= ~UPT1_F_RXVLAN;
>  			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
>  					       VMXNET3_CMD_UPDATE_FEATURE);
>  		}
> @@ -1762,15 +1760,15 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter)
>  
>  	/* set up feature flags */
>  	if (adapter->rxcsum)
> -		set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_RXCSUM);
> +		devRead->misc.uptFeatures |= UPT1_F_RXCSUM;
>  
>  	if (adapter->lro) {
> -		set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_LRO);
> +		devRead->misc.uptFeatures |= UPT1_F_LRO;
>  		devRead->misc.maxNumRxSG = cpu_to_le16(1 + MAX_SKB_FRAGS);
>  	}
>  	if ((adapter->netdev->features & NETIF_F_HW_VLAN_RX) &&
>  	    adapter->vlan_grp) {
> -		set_flag_le64(&devRead->misc.uptFeatures, UPT1_F_RXVLAN);
> +		devRead->misc.uptFeatures |= UPT1_F_RXVLAN;
>  	}
>  
>  	devRead->misc.mtu = cpu_to_le32(adapter->netdev->mtu);
> @@ -2577,7 +2575,7 @@ vmxnet3_suspend(struct device *device)
>  		memcpy(pmConf->filters[i].pattern, netdev->dev_addr, ETH_ALEN);
>  		pmConf->filters[i].mask[0] = 0x3F; /* LSB ETH_ALEN bits */
>  
> -		set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_FILTER);
> +		pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
>  		i++;
>  	}
>  
> @@ -2619,13 +2617,13 @@ vmxnet3_suspend(struct device *device)
>  		pmConf->filters[i].mask[5] = 0x03; /* IPv4 TIP */
>  		in_dev_put(in_dev);
>  
> -		set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_FILTER);
> +		pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_FILTER;
>  		i++;
>  	}
>  
>  skip_arp:
>  	if (adapter->wol & WAKE_MAGIC)
> -		set_flag_le16(&pmConf->wakeUpEvents, VMXNET3_PM_WAKEUP_MAGIC);
> +		pmConf->wakeUpEvents |= VMXNET3_PM_WAKEUP_MAGIC;
>  
>  	pmConf->numFilters = i;
>  
> diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
> index 7e4b5a8..b79070b 100644
> --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
> +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
> @@ -50,13 +50,11 @@ vmxnet3_set_rx_csum(struct net_device *netdev, u32 val)
>  		adapter->rxcsum = val;
>  		if (netif_running(netdev)) {
>  			if (val)
> -				set_flag_le64(
> -				&adapter->shared->devRead.misc.uptFeatures,
> -				UPT1_F_RXCSUM);
> +				adapter->shared->devRead.misc.uptFeatures |=
> +				UPT1_F_RXCSUM;
>  			else
> -				reset_flag_le64(
> -				&adapter->shared->devRead.misc.uptFeatures,
> -				UPT1_F_RXCSUM);
> +				adapter->shared->devRead.misc.uptFeatures &=
> +				~UPT1_F_RXCSUM;
>  
>  			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
>  					       VMXNET3_CMD_UPDATE_FEATURE);
> @@ -292,10 +290,10 @@ vmxnet3_set_flags(struct net_device *netdev, u32 data)
>  		/* update harware LRO capability accordingly */
>  		if (lro_requested)
>  			adapter->shared->devRead.misc.uptFeatures |=
> -						cpu_to_le64(UPT1_F_LRO);
> +							UPT1_F_LRO;
>  		else
>  			adapter->shared->devRead.misc.uptFeatures &=
> -						cpu_to_le64(~UPT1_F_LRO);
> +							~UPT1_F_LRO;
>  		VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
>  				       VMXNET3_CMD_UPDATE_FEATURE);
>  	}
> diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
> index c88ea5c..46aee6d 100644
> --- a/drivers/net/vmxnet3/vmxnet3_int.h
> +++ b/drivers/net/vmxnet3/vmxnet3_int.h
> @@ -353,21 +353,6 @@ struct vmxnet3_adapter {
>  #define VMXNET3_MAX_ETH_HDR_SIZE    22
>  #define VMXNET3_MAX_SKB_BUF_SIZE    (3*1024)
>  
> -static inline void set_flag_le16(__le16 *data, u16 flag)
> -{
> -	*data = cpu_to_le16(le16_to_cpu(*data) | flag);
> -}
> -
> -static inline void set_flag_le64(__le64 *data, u64 flag)
> -{
> -	*data = cpu_to_le64(le64_to_cpu(*data) | flag);
> -}
> -
> -static inline void reset_flag_le64(__le64 *data, u64 flag)
> -{
> -	*data = cpu_to_le64(le64_to_cpu(*data) & ~flag);
> -}
> -
>  int
>  vmxnet3_quiesce_dev(struct vmxnet3_adapter *adapter);
>  
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers
  2010-10-22  4:05 ` [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers Harvey Harrison
@ 2010-10-22 17:30   ` Shreyas Bhatewara
  2010-10-24 22:43   ` David Miller
  1 sibling, 0 replies; 15+ messages in thread
From: Shreyas Bhatewara @ 2010-10-22 17:30 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com

Thanks Harvey.

Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>

On Thu, 21 Oct 2010, Harvey Harrison wrote:

> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  drivers/net/vmxnet3/vmxnet3_int.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
> index 46aee6d..8a2f471 100644
> --- a/drivers/net/vmxnet3/vmxnet3_int.h
> +++ b/drivers/net/vmxnet3/vmxnet3_int.h
> @@ -301,8 +301,8 @@ struct vmxnet3_adapter {
>  	struct net_device              *netdev;
>  	struct pci_dev                 *pdev;
>  
> -	u8				*hw_addr0; /* for BAR 0 */
> -	u8				*hw_addr1; /* for BAR 1 */
> +	u8			__iomem *hw_addr0; /* for BAR 0 */
> +	u8			__iomem *hw_addr1; /* for BAR 1 */
>  
>  	/* feature control */
>  	bool				rxcsum;
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22  4:05 ` [PATCH 3/3] vmxnet3: fix typo setting confPA Harvey Harrison
@ 2010-10-22 17:31   ` Shreyas Bhatewara
  2010-10-22 17:39     ` Harvey Harrison
  2010-10-24 22:43   ` David Miller
  1 sibling, 1 reply; 15+ messages in thread
From: Shreyas Bhatewara @ 2010-10-22 17:31 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com




On Thu, 21 Oct 2010, Harvey Harrison wrote:

> It's a le64, not a le32, typo in one place only.
>

Sure it is. Thanks for the change.

Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>

 
> Noticed by sparse:
> drivers/net/vmxnet3/vmxnet3_drv.c:2668:52: warning: incorrect type in assignment (different base types)
> drivers/net/vmxnet3/vmxnet3_drv.c:2668:52:    expected restricted __le64 [usertype] confPA
> drivers/net/vmxnet3/vmxnet3_drv.c:2668:52:    got restricted __le32 [usertype] <noident>
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  drivers/net/vmxnet3/vmxnet3_drv.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
> index 2ea4b81..e3658e1 100644
> --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
> @@ -2665,7 +2665,7 @@ vmxnet3_resume(struct device *device)
>  	adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1);
>  	adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof(
>  								  *pmConf));
> -	adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le32(virt_to_phys(
> +	adapter->shared->devRead.pmConfDesc.confPA = cpu_to_le64(virt_to_phys(
>  								 pmConf));
>  
>  	netif_device_attach(netdev);
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22 17:31   ` Shreyas Bhatewara
@ 2010-10-22 17:39     ` Harvey Harrison
  2010-10-22 17:46       ` Shreyas Bhatewara
  0 siblings, 1 reply; 15+ messages in thread
From: Harvey Harrison @ 2010-10-22 17:39 UTC (permalink / raw)
  To: Shreyas Bhatewara; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com

On Fri, Oct 22, 2010 at 10:31 AM, Shreyas Bhatewara
<sbhatewara@vmware.com> wrote:
> On Thu, 21 Oct 2010, Harvey Harrison wrote:
>
>> It's a le64, not a le32, typo in one place only.
>>
>
> Sure it is. Thanks for the change.
>
> Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
>
>

One question I had when looking into this, why are you doing
byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1}
macros?

Harvey

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22 17:39     ` Harvey Harrison
@ 2010-10-22 17:46       ` Shreyas Bhatewara
  2010-10-22 17:52         ` Harvey Harrison
  0 siblings, 1 reply; 15+ messages in thread
From: Shreyas Bhatewara @ 2010-10-22 17:46 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com

> -----Original Message-----
> From: Harvey Harrison [mailto:harvey.harrison@gmail.com]
> Sent: Friday, October 22, 2010 10:40 AM
> To: Shreyas Bhatewara
> Cc: netdev@vger.kernel.org; shemminger@vyatta.com
> Subject: Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
> 
> On Fri, Oct 22, 2010 at 10:31 AM, Shreyas Bhatewara
> <sbhatewara@vmware.com> wrote:
> > On Thu, 21 Oct 2010, Harvey Harrison wrote:
> >
> >> It's a le64, not a le32, typo in one place only.
> >>
> >
> > Sure it is. Thanks for the change.
> >
> > Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
> >
> >
> 
> One question I had when looking into this, why are you doing
> byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1}
> macros?

Because values need to be written in LE orders in registers. For eg. when rx_ring.next2fill index is written to RXPROD reg, it should be converted from CPU order to LE.

->Shreyas


> 
> Harvey



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22 17:46       ` Shreyas Bhatewara
@ 2010-10-22 17:52         ` Harvey Harrison
  2010-10-22 18:10           ` Shreyas Bhatewara
  2010-10-24 22:44           ` David Miller
  0 siblings, 2 replies; 15+ messages in thread
From: Harvey Harrison @ 2010-10-22 17:52 UTC (permalink / raw)
  To: Shreyas Bhatewara; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com

On Fri, Oct 22, 2010 at 10:46 AM, Shreyas Bhatewara
<sbhatewara@vmware.com> wrote:
>> From: Harvey Harrison [mailto:harvey.harrison@gmail.com]
>> One question I had when looking into this, why are you doing
>> byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1}
>> macros?
>
> Because values need to be written in LE orders in registers. For eg. when rx_ring.next2fill index is written to RXPROD reg, it should be converted from CPU order to LE.

Yes, but (unless I'm mistaken) writel always writes out in
little-endian, so there isn't a need to swap the arguments,
similarly for readl in the other direction.

You wouldn't notice this on a little-endian machine obviously, has
this even bee tried on be?

Harvey

^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22 17:52         ` Harvey Harrison
@ 2010-10-22 18:10           ` Shreyas Bhatewara
  2010-10-24 22:44           ` David Miller
  1 sibling, 0 replies; 15+ messages in thread
From: Shreyas Bhatewara @ 2010-10-22 18:10 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: netdev@vger.kernel.org, shemminger@vyatta.com



> -----Original Message-----
> From: Harvey Harrison [mailto:harvey.harrison@gmail.com]
> Sent: Friday, October 22, 2010 10:52 AM
> To: Shreyas Bhatewara
> Cc: netdev@vger.kernel.org; shemminger@vyatta.com
> Subject: Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
> 
> On Fri, Oct 22, 2010 at 10:46 AM, Shreyas Bhatewara
> <sbhatewara@vmware.com> wrote:
> >> From: Harvey Harrison [mailto:harvey.harrison@gmail.com]
> >> One question I had when looking into this, why are you doing
> >> byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1}
> >> macros?
> >
> > Because values need to be written in LE orders in registers. For eg.
> when rx_ring.next2fill index is written to RXPROD reg, it should be
> converted from CPU order to LE.
> 
> Yes, but (unless I'm mistaken) writel always writes out in
> little-endian, so there isn't a need to swap the arguments,
> similarly for readl in the other direction.
> 
> You wouldn't notice this on a little-endian machine obviously, has
> this even bee tried on be?

No, the virtualized NIC vmxnet3 will not be available in BE architectures as far as I can tell. Hence the driver can never be exercised on BE machines. The BE support was just put in the driver to get rid of the compile time X86 dependency in config files because developers often used BE machines to test the kernel builds. 

Best regards.
Shreyas


> 
> Harvey

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers
  2010-10-22  4:05 [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Harvey Harrison
                   ` (2 preceding siblings ...)
  2010-10-22 17:29 ` [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Shreyas Bhatewara
@ 2010-10-24 22:43 ` David Miller
  3 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2010-10-24 22:43 UTC (permalink / raw)
  To: harvey.harrison; +Cc: sbhatewara, netdev, shemminger

From: Harvey Harrison <harvey.harrison@gmail.com>
Date: Thu, 21 Oct 2010 21:05:32 -0700

> It's easier to just annotate the constants as little endian types and set/clear
> the flags directly.
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers
  2010-10-22  4:05 ` [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers Harvey Harrison
  2010-10-22 17:30   ` Shreyas Bhatewara
@ 2010-10-24 22:43   ` David Miller
  1 sibling, 0 replies; 15+ messages in thread
From: David Miller @ 2010-10-24 22:43 UTC (permalink / raw)
  To: harvey.harrison; +Cc: sbhatewara, netdev, shemminger

From: Harvey Harrison <harvey.harrison@gmail.com>
Date: Thu, 21 Oct 2010 21:05:33 -0700

> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22  4:05 ` [PATCH 3/3] vmxnet3: fix typo setting confPA Harvey Harrison
  2010-10-22 17:31   ` Shreyas Bhatewara
@ 2010-10-24 22:43   ` David Miller
  1 sibling, 0 replies; 15+ messages in thread
From: David Miller @ 2010-10-24 22:43 UTC (permalink / raw)
  To: harvey.harrison; +Cc: sbhatewara, netdev, shemminger

From: Harvey Harrison <harvey.harrison@gmail.com>
Date: Thu, 21 Oct 2010 21:05:34 -0700

> It's a le64, not a le32, typo in one place only.
> 
> Noticed by sparse:
> drivers/net/vmxnet3/vmxnet3_drv.c:2668:52: warning: incorrect type in assignment (different base types)
> drivers/net/vmxnet3/vmxnet3_drv.c:2668:52:    expected restricted __le64 [usertype] confPA
> drivers/net/vmxnet3/vmxnet3_drv.c:2668:52:    got restricted __le32 [usertype] <noident>
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-22 17:52         ` Harvey Harrison
  2010-10-22 18:10           ` Shreyas Bhatewara
@ 2010-10-24 22:44           ` David Miller
  2010-10-25  1:46             ` Harvey Harrison
  1 sibling, 1 reply; 15+ messages in thread
From: David Miller @ 2010-10-24 22:44 UTC (permalink / raw)
  To: harvey.harrison; +Cc: sbhatewara, netdev, shemminger

From: Harvey Harrison <harvey.harrison@gmail.com>
Date: Fri, 22 Oct 2010 10:52:15 -0700

> On Fri, Oct 22, 2010 at 10:46 AM, Shreyas Bhatewara
> <sbhatewara@vmware.com> wrote:
>>> From: Harvey Harrison [mailto:harvey.harrison@gmail.com]
>>> One question I had when looking into this, why are you doing
>>> byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1}
>>> macros?
>>
>> Because values need to be written in LE orders in registers. For eg. when rx_ring.next2fill index is written to RXPROD reg, it should be converted from CPU order to LE.
> 
> Yes, but (unless I'm mistaken) writel always writes out in
> little-endian, so there isn't a need to swap the arguments,
> similarly for readl in the other direction.

That's right, readl() and writel() translate to little-endian.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
  2010-10-24 22:44           ` David Miller
@ 2010-10-25  1:46             ` Harvey Harrison
  0 siblings, 0 replies; 15+ messages in thread
From: Harvey Harrison @ 2010-10-25  1:46 UTC (permalink / raw)
  To: David Miller; +Cc: sbhatewara, netdev, shemminger

On Sun, Oct 24, 2010 at 3:44 PM, David Miller <davem@davemloft.net> wrote:
> From: Harvey Harrison <harvey.harrison@gmail.com>
>> <sbhatewara@vmware.com> wrote:
>>> Because values need to be written in LE orders in registers. For eg. when rx_ring.next2fill index is written to RXPROD reg, it should be converted from CPU order to LE.
>>
>> Yes, but (unless I'm mistaken) writel always writes out in
>> little-endian, so there isn't a need to swap the arguments,
>> similarly for readl in the other direction.
>
> That's right, readl() and writel() translate to little-endian.
>

OK, I'll submit patches for this and one more endian fix I found (only
visible on BE)

Harvey

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-10-25  1:46 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-22  4:05 [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Harvey Harrison
2010-10-22  4:05 ` [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers Harvey Harrison
2010-10-22 17:30   ` Shreyas Bhatewara
2010-10-24 22:43   ` David Miller
2010-10-22  4:05 ` [PATCH 3/3] vmxnet3: fix typo setting confPA Harvey Harrison
2010-10-22 17:31   ` Shreyas Bhatewara
2010-10-22 17:39     ` Harvey Harrison
2010-10-22 17:46       ` Shreyas Bhatewara
2010-10-22 17:52         ` Harvey Harrison
2010-10-22 18:10           ` Shreyas Bhatewara
2010-10-24 22:44           ` David Miller
2010-10-25  1:46             ` Harvey Harrison
2010-10-24 22:43   ` David Miller
2010-10-22 17:29 ` [PATCH 1/3] vmxnet3: remove set_flag_le{16,64} helpers Shreyas Bhatewara
2010-10-24 22:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).