Prev: net-next: vmxnet3 fixes [4/5] Do not reset when the device is not opened
Next: rcu: apply ->rda changes to rcutree_trace.c
From: David Miller on 14 Jul 2010 17:10 From: Shreyas Bhatewara <sbhatewara(a)vmware.com> Date: Tue, 13 Jul 2010 17:48:04 -0700 (PDT) > - __le32 reserved[3]; > + __le32 intrCtrl; > + __le32 reserved[2]; > }; > ... > + adapter->shared->devRead.intrConf.intrCtrl &= ~VMXNET3_IC_DISABLE_ALL; ... > + adapter->shared->devRead.intrConf.intrCtrl |= VMXNET3_IC_DISABLE_ALL; ... > + devRead->intrConf.intrCtrl |= VMXNET3_IC_DISABLE_ALL; You need to use cpu_to_le32() and similar when accessing this value. If you run "sparse" with endianness checking enabled you'll see warnings showing alerting you to this issue... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Shreyas Bhatewara on 15 Jul 2010 21:30 On Wed, 14 Jul 2010, David Miller wrote: > From: Shreyas Bhatewara <sbhatewara(a)vmware.com> > Date: Tue, 13 Jul 2010 17:48:04 -0700 (PDT) > > > - __le32 reserved[3]; > > + __le32 intrCtrl; > > + __le32 reserved[2]; > > }; > > > ... > > + adapter->shared->devRead.intrConf.intrCtrl &= ~VMXNET3_IC_DISABLE_ALL; > ... > > + adapter->shared->devRead.intrConf.intrCtrl |= VMXNET3_IC_DISABLE_ALL; > ... > > + devRead->intrConf.intrCtrl |= VMXNET3_IC_DISABLE_ALL; > > You need to use cpu_to_le32() and similar when accessing this value. > > If you run "sparse" with endianness checking enabled you'll see > warnings showing alerting you to this issue... > Reposting the patch with the endianness fix. --- A new bit map 'intrCtrl' is introduced in the DriverShared area. The driver Ashould update VMXNET3_IC_DISABLE_ALL bit before writing IMR. Signed-off-by: Ronghua Zang <ronghua(a)vmware.com> Signed-off-by: Shreyas Bhatewara <sbhatewara(a)vmware.com> --- drivers/net/vmxnet3/vmxnet3_defs.h | 6 +++++- drivers/net/vmxnet3/vmxnet3_drv.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_defs.h b/drivers/net/vmxnet3/vmxnet3_defs.h index b4889e6..ca7727b 100644 --- a/drivers/net/vmxnet3/vmxnet3_defs.h +++ b/drivers/net/vmxnet3/vmxnet3_defs.h @@ -464,6 +464,9 @@ enum vmxnet3_intr_type { /* addition 1 for events */ #define VMXNET3_MAX_INTRS 25 +/* value of intrCtrl */ +#define VMXNET3_IC_DISABLE_ALL 0x1 /* bit 0 */ + struct Vmxnet3_IntrConf { bool autoMask; @@ -471,7 +474,8 @@ struct Vmxnet3_IntrConf { u8 eventIntrIdx; u8 modLevels[VMXNET3_MAX_INTRS]; /* moderation level for * each intr */ - __le32 reserved[3]; + __le32 intrCtrl; + __le32 reserved[2]; }; /* one bit per VLAN ID, the size is in the units of u32 */ diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 5a50d10..df3d2ac 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -72,6 +72,8 @@ vmxnet3_enable_all_intrs(struct vmxnet3_adapter *adapter) for (i = 0; i < adapter->intr.num_intrs; i++) vmxnet3_enable_intr(adapter, i); + adapter->shared->devRead.intrConf.intrCtrl &= + cpu_to_le32(~VMXNET3_IC_DISABLE_ALL); } @@ -80,6 +82,8 @@ vmxnet3_disable_all_intrs(struct vmxnet3_adapter *adapter) { int i; + adapter->shared->devRead.intrConf.intrCtrl |= + cpu_to_le32(VMXNET3_IC_DISABLE_ALL); for (i = 0; i < adapter->intr.num_intrs; i++) vmxnet3_disable_intr(adapter, i); } @@ -1880,6 +1884,7 @@ vmxnet3_setup_driver_shared(struct vmxnet3_adapter *adapter) devRead->intrConf.modLevels[i] = adapter->intr.mod_levels[i]; devRead->intrConf.eventIntrIdx = adapter->intr.event_intr_idx; + devRead->intrConf.intrCtrl |= cpu_to_le32(VMXNET3_IC_DISABLE_ALL); /* rx filter settings */ devRead->rxFilterConf.rxMode = 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Miller on 16 Jul 2010 01:20
From: Shreyas Bhatewara <sbhatewara(a)vmware.com> Date: Thu, 15 Jul 2010 18:20:03 -0700 (PDT) > Reposting the patch with the endianness fix. > > --- > > A new bit map 'intrCtrl' is introduced in the DriverShared area. The > driver Ashould update VMXNET3_IC_DISABLE_ALL bit before writing IMR. > > Signed-off-by: Ronghua Zang <ronghua(a)vmware.com> > Signed-off-by: Shreyas Bhatewara <sbhatewara(a)vmware.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |