* [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event()
@ 2014-10-23 3:06 Jeff Kirsher
2014-10-23 3:22 ` Joe Perches
2014-10-25 20:51 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Jeff Kirsher @ 2014-10-23 3:06 UTC (permalink / raw)
To: davem; +Cc: Dan Carpenter, netdev, nhorman, sassmann, jogreene, Jeff Kirsher
From: Dan Carpenter <dan.carpenter@oracle.com>
We accidentally mask by the _SHIFT variable. It means that "event" is
always zero.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Jim Young <jamesx.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index ed5f1c1..c3a7f4a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6151,7 +6151,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
I40E_GL_MDET_TX_PF_NUM_SHIFT;
u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >>
I40E_GL_MDET_TX_VF_NUM_SHIFT;
- u8 event = (reg & I40E_GL_MDET_TX_EVENT_SHIFT) >>
+ u8 event = (reg & I40E_GL_MDET_TX_EVENT_MASK) >>
I40E_GL_MDET_TX_EVENT_SHIFT;
u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >>
I40E_GL_MDET_TX_QUEUE_SHIFT;
@@ -6165,7 +6165,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
if (reg & I40E_GL_MDET_RX_VALID_MASK) {
u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >>
I40E_GL_MDET_RX_FUNCTION_SHIFT;
- u8 event = (reg & I40E_GL_MDET_RX_EVENT_SHIFT) >>
+ u8 event = (reg & I40E_GL_MDET_RX_EVENT_MASK) >>
I40E_GL_MDET_RX_EVENT_SHIFT;
u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >>
I40E_GL_MDET_RX_QUEUE_SHIFT;
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event()
2014-10-23 3:06 [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event() Jeff Kirsher
@ 2014-10-23 3:22 ` Joe Perches
2014-10-23 4:05 ` Joe Perches
2014-10-25 20:51 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2014-10-23 3:22 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, Dan Carpenter, netdev, nhorman, sassmann, jogreene
On Wed, 2014-10-22 at 20:06 -0700, Jeff Kirsher wrote:
> We accidentally mask by the _SHIFT variable. It means that "event" is
> always zero.
[]
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
[]
> @@ -6151,7 +6151,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
> I40E_GL_MDET_TX_PF_NUM_SHIFT;
> u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >>
> I40E_GL_MDET_TX_VF_NUM_SHIFT;
> - u8 event = (reg & I40E_GL_MDET_TX_EVENT_SHIFT) >>
> + u8 event = (reg & I40E_GL_MDET_TX_EVENT_MASK) >>
> I40E_GL_MDET_TX_EVENT_SHIFT;
> u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >>
> I40E_GL_MDET_TX_QUEUE_SHIFT;
> @@ -6165,7 +6165,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
> if (reg & I40E_GL_MDET_RX_VALID_MASK) {
> u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >>
> I40E_GL_MDET_RX_FUNCTION_SHIFT;
> - u8 event = (reg & I40E_GL_MDET_RX_EVENT_SHIFT) >>
> + u8 event = (reg & I40E_GL_MDET_RX_EVENT_MASK) >>
> I40E_GL_MDET_RX_EVENT_SHIFT;
> u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >>
> I40E_GL_MDET_RX_QUEUE_SHIFT;
It might be useful to have a macro for that.
Something like:
#define GET_REG_VAL(reg, type) \
((reg & type##_MASK) >> type##_SHIFT)
so these could become:
u8 vf_num = GET_REG_VAL(reg, I40E_GL_MDET_TX_VF_NUM);
u8 event = GET_REG_VAL(reg, I40E_GL_MDET_TX_EVENT);
etc...
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event()
2014-10-23 3:22 ` Joe Perches
@ 2014-10-23 4:05 ` Joe Perches
0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2014-10-23 4:05 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, Dan Carpenter, netdev, nhorman, sassmann, jogreene
On Wed, 2014-10-22 at 20:22 -0700, Joe Perches wrote:
> On Wed, 2014-10-22 at 20:06 -0700, Jeff Kirsher wrote:
> > We accidentally mask by the _SHIFT variable. It means that "event" is
> > always zero.
> []
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> []
> > @@ -6151,7 +6151,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
> > I40E_GL_MDET_TX_PF_NUM_SHIFT;
> > u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >>
> > I40E_GL_MDET_TX_VF_NUM_SHIFT;
> > - u8 event = (reg & I40E_GL_MDET_TX_EVENT_SHIFT) >>
> > + u8 event = (reg & I40E_GL_MDET_TX_EVENT_MASK) >>
> > I40E_GL_MDET_TX_EVENT_SHIFT;
> > u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >>
> > I40E_GL_MDET_TX_QUEUE_SHIFT;
> > @@ -6165,7 +6165,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
> > if (reg & I40E_GL_MDET_RX_VALID_MASK) {
> > u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >>
> > I40E_GL_MDET_RX_FUNCTION_SHIFT;
> > - u8 event = (reg & I40E_GL_MDET_RX_EVENT_SHIFT) >>
> > + u8 event = (reg & I40E_GL_MDET_RX_EVENT_MASK) >>
> > I40E_GL_MDET_RX_EVENT_SHIFT;
> > u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >>
> > I40E_GL_MDET_RX_QUEUE_SHIFT;
>
> It might be useful to have a macro for that.
> Something like:
>
> #define GET_REG_VAL(reg, type) \
> ((reg & type##_MASK) >> type##_SHIFT)
>
> so these could become:
>
> u8 vf_num = GET_REG_VAL(reg, I40E_GL_MDET_TX_VF_NUM);
> u8 event = GET_REG_VAL(reg, I40E_GL_MDET_TX_EVENT);
>
> etc...
btw: Here's a defect:
Using the macro would also prevent this sort of precedence defect
diff --git a/drivers/net/ethernet/intel/i40e/i40e_common.c b/drivers/net/ethernet/intel/i40e/i40e_common.c
[]
@@ -809,8 +809,8 @@ i40e_status i40e_pf_reset(struct i40e_hw *hw)
* The grst delay value is in 100ms units, and we'll wait a
* couple counts longer to be sure we don't just miss the end.
*/
- grst_del = rd32(hw, I40E_GLGEN_RSTCTL) & I40E_GLGEN_RSTCTL_GRSTDEL_MASK
- >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT;
bit shift has higher precedence than bitwise &
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event()
2014-10-23 3:06 [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event() Jeff Kirsher
2014-10-23 3:22 ` Joe Perches
@ 2014-10-25 20:51 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2014-10-25 20:51 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: dan.carpenter, netdev, nhorman, sassmann, jogreene
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 22 Oct 2014 20:06:29 -0700
> From: Dan Carpenter <dan.carpenter@oracle.com>
>
> We accidentally mask by the _SHIFT variable. It means that "event" is
> always zero.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Tested-by: Jim Young <jamesx.m.young@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-25 20:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-23 3:06 [net] i40e: _MASK vs _SHIFT typo in i40e_handle_mdd_event() Jeff Kirsher
2014-10-23 3:22 ` Joe Perches
2014-10-23 4:05 ` Joe Perches
2014-10-25 20:51 ` 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).