vmxnet3: remove set_flag_le{16,64} helpers
Subsystems (3)
PATCH 1/3 vmxnet3: remove set_flag_le{16,64} helpers
It's easier to just annotate the constants as little endian types and set/clear the flags directly.
--- 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(-)
drivers/net/vmxnet3/upt1_defs.h +4 -4
@@ -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
drivers/net/vmxnet3/vmxnet3_defs.h +3 -3
@@ -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 {
drivers/net/vmxnet3/vmxnet3_drv.c +9 -11
@@ -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;
drivers/net/vmxnet3/vmxnet3_ethtool.c +6 -8
@@ -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 ); }
drivers/net/vmxnet3/vmxnet3_int.h +0 -15
@@ -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);
Signature · 1 line
1.7.1
PATCH 2/3 vmxnet3: annotate hwaddr members as __iomem pointers
--- drivers/net/vmxnet3/vmxnet3_int.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/vmxnet3/vmxnet3_int.h +2 -2
@@ -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;
Signature · 1 line
1.7.1
Re: [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers
Thanks Harvey.
Quoted 24 lines · Harvey Harrison
Signed-off-by Harvey Harrison <[email protected]>--- drivers/net/vmxnet3/vmxnet3_int.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/net/vmxnet3/vmxnet3_int.h +2
-2@@ -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;Signature · 1 line
1.7.1
Re: [PATCH 2/3] vmxnet3: annotate hwaddr members as __iomem pointers
In reply to Harvey HarrisonFrom: Harvey Harrison <[email protected]>
Date: Thu, 21 Oct 2010 21:05:33 -0700
Quoted 1 line
Signed-off-by Harvey Harrison <[email protected]>
Applied.
PATCH 3/3 vmxnet3: fix typo setting confPA
In reply to Harvey HarrisonIt'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] confPAdrivers/net/vmxnet3/vmxnet3_drv.c:2668:52: got restricted __le32 [usertype] <noident>
--- drivers/net/vmxnet3/vmxnet3_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/vmxnet3/vmxnet3_drv.c +1 -1
@@ -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);
Signature · 1 line
1.7.1
Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
Quoted 2 lines · Harvey Harrison
It's a le64, not a le32, typo in one place only.
Sure it is. Thanks for the change.
Quoted 27 lines
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] confPAdrivers/net/vmxnet3/vmxnet3_drv.c:2668:52: got restricted__le32[usertype] <noident>Signed-off-by Harvey Harrison <[email protected]>--- drivers/net/vmxnet3/vmxnet3_drv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/vmxnet3/vmxnet3_drv.c +1
-1@@ -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);Signature · 1 line
1.7.1
Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
Quoted 10 lines · Shreyas Bhatewara
Quoted 2 lines · Harvey Harrison
It's a le64, not a le32, typo in one place only.
Sure it is. Thanks for the change.
Signed-off-by Shreyas Bhatewara <[email protected]>
One question I had when looking into this, why are you doing byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1} macros?
Harvey
RE: [PATCH 3/3] vmxnet3: fix typo setting confPA
Quoted 16 lines
-----Original Message-----
From: Harvey Harrison [mailto:[email protected]]
Sent: Friday, October 22, 2010 10:40 AM
To: Shreyas Bhatewara
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 3/3] vmxnet3: fix typo setting confPAQuoted 7 lines · Shreyas Bhatewara
Quoted 2 lines · Harvey Harrison
It's a le64, not a le32, typo in one place only.
Sure it is. Thanks for the change.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Shreyas Bhatewara <[email protected]>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
Quoted 2 lines
Harvey
Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
Quoted 6 lines · Shreyas Bhatewara
Quoted 4 lines
From: Harvey Harrison [mailto:[email protected]] 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
RE: [PATCH 3/3] vmxnet3: fix typo setting confPA
Quoted 20 lines
-----Original Message-----
From: Harvey Harrison [mailto:[email protected]]
Sent: Friday, October 22, 2010 10:52 AM
To: Shreyas Bhatewara
Cc: [email protected]; [email protected]
Subject: Re: [PATCH 3/3] vmxnet3: fix typo setting confPAQuoted 6 lines · Shreyas Bhatewara
Quoted 4 lines
From: Harvey Harrison [mailto:[email protected]] 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.
Quoted 6 lines
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
Quoted 2 lines
Harvey
David Miller
maintainerRe: [PATCH 3/3] vmxnet3: fix typo setting confPA
In reply to Harvey HarrisonFrom: Harvey Harrison <[email protected]>
Date: Fri, 22 Oct 2010 10:52:15 -0700
Quoted 7 lines
Quoted 5 lines · Shreyas Bhatewara
Quoted 4 lines
From: Harvey Harrison [mailto:[email protected]] One question I had when looking into this, why are you doing byteswapping in the VMXNET_{READ,WRITE}_BAR{0,1} macros?
Quoted 5 lines
Quoted 1 line
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.
Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
Quoted 10 lines · David Miller
From: Harvey Harrison <[email protected]>
Quoted 6 lines
Quoted 1 line · <[email protected]> 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()andwritel()translate to little-endian.
OK, I'll submit patches for this and one more endian fix I found (only visible on BE)
Harvey
Re: [PATCH 3/3] vmxnet3: fix typo setting confPA
In reply to Harvey HarrisonFrom: Harvey Harrison <[email protected]>
Date: Thu, 21 Oct 2010 21:05:34 -0700
Quoted 8 lines
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] confPAdrivers/net/vmxnet3/vmxnet3_drv.c:2668:52: got restricted__le32[usertype] <noident>Signed-off-by Harvey Harrison <[email protected]>
Applied.
Harvey,
Thanks for doing this.
Quoted 189 lines · Harvey Harrison
It's easier to just annotate the constants as little endian types and set/clear the flags directly.
Signed-off-by Harvey Harrison <[email protected]>--- 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(-)drivers/net/vmxnet3/upt1_defs.h +4
-4@@ -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 drivers/net/vmxnet3/vmxnet3_defs.h +3
-3@@ -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 {drivers/net/vmxnet3/vmxnet3_drv.c +9
-11@@ -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;drivers/net/vmxnet3/vmxnet3_ethtool.c +6
-8@@ -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 ); }drivers/net/vmxnet3/vmxnet3_int.h +0
-15@@ -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);Signature · 1 line
1.7.1
From: Harvey Harrison <[email protected]>
Date: Thu, 21 Oct 2010 21:05:32 -0700
Quoted 4 lines
It's easier to just annotate the constants as little endian types and set/clear the flags directly.
Signed-off-by Harvey Harrison <[email protected]>
Applied.