diff options
author | Michael Chan <mchan@broadcom.com> | 2010-05-18 07:32:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-05-18 18:16:44 -0400 |
commit | 1f1332a3cb7ac73e3bcff6ea42ff965c90a29d12 (patch) | |
tree | d0e3d63b8579831f2ad1ea6abdb9860f5f4893eb /drivers/net | |
parent | 57c8a456640fa3ca777652f11f2db4179a3e66b6 (diff) |
cnic: Convert cnic_local_flags to atomic ops.
It is easier to expand the flags for other purposes because it does
not require a spin_lock. The next bug fix patch needs a flag in
cnic_local_flags.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/cnic.c | 6 | ||||
-rw-r--r-- | drivers/net/cnic.h | 5 |
2 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 4b08b18ca5d6..7c6d325b880a 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -1143,12 +1143,12 @@ static int cnic_submit_bnx2_kwqes(struct cnic_dev *dev, struct kwqe *wqes[], | |||
1143 | 1143 | ||
1144 | spin_lock_bh(&cp->cnic_ulp_lock); | 1144 | spin_lock_bh(&cp->cnic_ulp_lock); |
1145 | if (num_wqes > cnic_kwq_avail(cp) && | 1145 | if (num_wqes > cnic_kwq_avail(cp) && |
1146 | !(cp->cnic_local_flags & CNIC_LCL_FL_KWQ_INIT)) { | 1146 | !test_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags)) { |
1147 | spin_unlock_bh(&cp->cnic_ulp_lock); | 1147 | spin_unlock_bh(&cp->cnic_ulp_lock); |
1148 | return -EAGAIN; | 1148 | return -EAGAIN; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | cp->cnic_local_flags &= ~CNIC_LCL_FL_KWQ_INIT; | 1151 | clear_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags); |
1152 | 1152 | ||
1153 | prod = cp->kwq_prod_idx; | 1153 | prod = cp->kwq_prod_idx; |
1154 | sw_prod = prod & MAX_KWQ_IDX; | 1154 | sw_prod = prod & MAX_KWQ_IDX; |
@@ -3690,7 +3690,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev) | |||
3690 | cp->max_kwq_idx = MAX_KWQ_IDX; | 3690 | cp->max_kwq_idx = MAX_KWQ_IDX; |
3691 | cp->kwq_prod_idx = 0; | 3691 | cp->kwq_prod_idx = 0; |
3692 | cp->kwq_con_idx = 0; | 3692 | cp->kwq_con_idx = 0; |
3693 | cp->cnic_local_flags |= CNIC_LCL_FL_KWQ_INIT; | 3693 | set_bit(CNIC_LCL_FL_KWQ_INIT, &cp->cnic_local_flags); |
3694 | 3694 | ||
3695 | if (CHIP_NUM(cp) == CHIP_NUM_5706 || CHIP_NUM(cp) == CHIP_NUM_5708) | 3695 | if (CHIP_NUM(cp) == CHIP_NUM_5706 || CHIP_NUM(cp) == CHIP_NUM_5708) |
3696 | cp->kwq_con_idx_ptr = &sblk->status_rx_quick_consumer_index15; | 3696 | cp->kwq_con_idx_ptr = &sblk->status_rx_quick_consumer_index15; |
diff --git a/drivers/net/cnic.h b/drivers/net/cnic.h index a0d853dff983..4422497249d1 100644 --- a/drivers/net/cnic.h +++ b/drivers/net/cnic.h | |||
@@ -179,9 +179,8 @@ struct cnic_local { | |||
179 | #define ULP_F_CALL_PENDING 2 | 179 | #define ULP_F_CALL_PENDING 2 |
180 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; | 180 | struct cnic_ulp_ops *ulp_ops[MAX_CNIC_ULP_TYPE]; |
181 | 181 | ||
182 | /* protected by ulp_lock */ | 182 | unsigned long cnic_local_flags; |
183 | u32 cnic_local_flags; | 183 | #define CNIC_LCL_FL_KWQ_INIT 0x0 |
184 | #define CNIC_LCL_FL_KWQ_INIT 0x00000001 | ||
185 | 184 | ||
186 | struct cnic_dev *dev; | 185 | struct cnic_dev *dev; |
187 | 186 | ||